feat: update filter dropdown style

This commit is contained in:
jinhojang6 2024-10-01 22:43:40 +09:00
parent b131782a77
commit b75923a9c2
3 changed files with 36 additions and 35 deletions

View File

@ -1,10 +1,33 @@
import styled from '@emotion/styled' import styled from '@emotion/styled'
const CustomCheckboxWrapper = styled.label` interface CustomCheckboxProps {
checked: boolean
onChange: () => void
label: string
}
const Checkbox: React.FC<CustomCheckboxProps> = ({
checked,
onChange,
label,
}) => (
<Container>
<HiddenCheckbox type="checkbox" checked={checked} onChange={onChange} />
<StyledCheckbox isChecked={checked} />
<LabelText>{label}</LabelText>
</Container>
)
const Container = styled.label`
display: flex; display: flex;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
margin-bottom: 10px; padding: 10px 16px 10px 11px;
border-bottom: 1px solid white;
&:last-of-type {
border-bottom: none;
}
` `
const HiddenCheckbox = styled.input` const HiddenCheckbox = styled.input`
@ -20,7 +43,7 @@ const StyledCheckbox = styled.span<{ isChecked: boolean }>`
width: 18px; width: 18px;
height: 18px; height: 18px;
background-color: ${({ isChecked }) => (isChecked ? 'white' : 'black')}; background-color: ${({ isChecked }) => (isChecked ? 'white' : 'black')};
border: 2px solid white; border: 1px solid white;
position: relative; position: relative;
margin-right: 10px; margin-right: 10px;
@ -38,22 +61,4 @@ const LabelText = styled.span`
color: white; color: white;
` `
interface CustomCheckboxProps {
checked: boolean
onChange: () => void
label: string
}
const Checkbox: React.FC<CustomCheckboxProps> = ({
checked,
onChange,
label,
}) => (
<CustomCheckboxWrapper>
<HiddenCheckbox type="checkbox" checked={checked} onChange={onChange} />
<StyledCheckbox isChecked={checked} />
<LabelText>{label}</LabelText>
</CustomCheckboxWrapper>
)
export default Checkbox export default Checkbox

View File

@ -64,7 +64,7 @@ const Dropdown: React.FC<DropdownProps> = ({
return ( return (
<DropdownContainer ref={dropdownRef}> <DropdownContainer ref={dropdownRef}>
<DropdownHeader onClick={toggleDropdown}> <DropdownHeader onClick={toggleDropdown} isExpanded={isExpanded}>
<span>{title}</span> <span>{title}</span>
<Chevron isExpanded={isExpanded}> <Chevron isExpanded={isExpanded}>
<img src="/assets/chevron-down.svg" alt="chevron down" /> <img src="/assets/chevron-down.svg" alt="chevron down" />
@ -98,15 +98,15 @@ const DropdownContainer = styled.div`
width: 200px; width: 200px;
` `
const DropdownHeader = styled.div` const DropdownHeader = styled.div<{ isExpanded: boolean }>`
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px; padding: 10px;
cursor: pointer; cursor: pointer;
border: 1px solid white; border: 1px solid white;
background-color: black; background-color: ${({ isExpanded }) => (isExpanded ? 'white' : 'black')};
color: white; color: ${({ isExpanded }) => (isExpanded ? 'black' : 'white')};
` `
const Chevron = styled.span<{ isExpanded: boolean }>` const Chevron = styled.span<{ isExpanded: boolean }>`
@ -124,27 +124,25 @@ const DropdownContent = styled.div`
background-color: black; background-color: black;
border: 1px solid white; border: 1px solid white;
z-index: 10; z-index: 10;
padding: 10px;
box-sizing: border-box; box-sizing: border-box;
` `
const ButtonContainer = styled.div` const ButtonContainer = styled.div`
display: flex; display: flex;
margin-top: 10px; height: 40px;
` `
const Button = styled.button` const Button = styled.button`
background-color: transparent; background-color: transparent;
border: 1px solid white; border-top: 1px solid white;
width: 100%; width: 100%;
padding: 10px 16px;
color: white; color: white;
padding: 5px;
cursor: pointer; cursor: pointer;
transition: background-color 0.3s;
&:hover { &:first-of-type {
background-color: white; border-right: 1px solid white;
color: black;
} }
` `

View File

@ -126,14 +126,12 @@ const GridItem = styled.div`
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
background-color: var(--grey-900); background-color: var(--grey-900);
border-radius: 8px;
` `
const Placeholder = styled.div` const Placeholder = styled.div`
width: 100%; width: 100%;
aspect-ratio: 1; aspect-ratio: 1;
background-color: var(--grey-900); background-color: var(--grey-900);
border-radius: 8px;
opacity: 0.5; opacity: 0.5;
` `