Skip to content

Commit

Permalink
Updated styling
Browse files Browse the repository at this point in the history
  • Loading branch information
remyvdwereld committed Aug 14, 2023
1 parent 9061ea3 commit 85adbd9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions src/app/components/addresses/AddressHeader/AddressHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from "styled-components"
import { breakpoint, themeSpacing, Typography } from "@amsterdam/asc-ui"

import { useBAG } from "app/state/rest"
import ShowOtherAddressesButton from "app/components/addresses/AddressSuffixSwitcher/ShowOtherAddressesButton"
import ShowOtherAddressesButton, { Index } from "app/components/addresses/AddressSuffixSwitcher/ShowOtherAddressesButton"
import useOtherAddressesByBagId from "app/state/rest/custom/useOtherAddresses/useOtherAddresses"
import AddressLink from "./components/AddressLink"
import getAddressFromBagResults from "app/components/addresses/utils/getAddressFromBagResults"
Expand Down Expand Up @@ -37,10 +37,12 @@ const AddressHeader: React.FC<Props> = ({ bagId, headingSize = "h2", isHeader =
const showButton = enableSwitch && (filteredAddresses?.length ?? 0) > 1
const isCurrentAddress = (address: { adres: string }) => address.adres.trim() === foundAddress?.adres.trim()
const addressIndex = filteredAddresses?.findIndex(isCurrentAddress) ?? -1
const index
= addressIndex === 0 ? "first"
: addressIndex > 0 && addressIndex === (filteredAddresses?.length ?? 0) - 1 ? "last"
: undefined
let index: Index = undefined
if (addressIndex === 0) {
index = "first"
} else if (addressIndex > 0 && addressIndex === (filteredAddresses?.length ?? 0) - 1) {
index = "last"
}

// TODO: Show loading status visually
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button, Icon } from "@amsterdam/asc-ui"
import { useModal } from "app/components/shared/Modal/hooks/useModal"
import OtherAddressesModal from "./OtherAddressesModal"

type Index = "first" | "last" | undefined
export type Index = "first" | "last" | undefined
type Props = {
bagId: Components.Schemas.Address["bag_id"]
index: Index
Expand All @@ -21,9 +21,9 @@ const StyledIcon = styled(Icon)`
const renderIcon = (index: Index) => {
switch(index) {
case "first":
return <StyledIcon size={32}><ExpandMore/></StyledIcon>
return <StyledIcon size={ 32 }><ExpandMore/></StyledIcon>
case "last":
return <StyledIcon size={32}><ExpandLess/></StyledIcon>
return <StyledIcon size={ 32 }><ExpandLess/></StyledIcon>
default:
return <StyledIcon
size={ 32 }
Expand Down

0 comments on commit 85adbd9

Please sign in to comment.