-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop/fe' of https://github.com/woowacourse-teams/202…
…4-touroot into feature/fe/#339
- Loading branch information
Showing
125 changed files
with
3,921 additions
and
624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
frontend/src/components/common/Checkbox/Checkbox.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { fn } from "@storybook/test"; | ||
|
||
import Checkbox from "./Checkbox"; | ||
|
||
const meta = { | ||
title: "common/Checkbox", | ||
component: Checkbox, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
argTypes: { | ||
isChecked: { | ||
control: { | ||
type: "boolean", | ||
}, | ||
description: "체크 박스의 체크 상태", | ||
}, | ||
onChange: { | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
}, | ||
|
||
tags: ["autodocs"], | ||
args: { | ||
onChange: fn(), | ||
}, | ||
decorators: [(Story) => <Story />], | ||
} satisfies Meta<typeof Checkbox>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const NonCheck: Story = { | ||
args: { | ||
isChecked: false, | ||
}, | ||
}; | ||
|
||
export const Check = { | ||
args: { | ||
isChecked: true, | ||
}, | ||
}; |
20 changes: 20 additions & 0 deletions
20
frontend/src/components/common/Checkbox/Checkbox.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
import { PRIMITIVE_COLORS } from "@styles/tokens"; | ||
|
||
export const Layout = styled.label<{ $isChecked: boolean }>` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
border: ${({ theme, $isChecked }) => ($isChecked ? "none" : `1px solid ${theme.colors.border}`)}; | ||
border-radius: 4px; | ||
background-color: ${({ $isChecked, theme }) => | ||
$isChecked ? theme.colors.primary : PRIMITIVE_COLORS.white}; | ||
`; | ||
|
||
export const Checkbox = styled.input` | ||
display: none; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Icon from "@components/common/Icon/Icon"; | ||
|
||
import { PRIMITIVE_COLORS } from "@styles/tokens"; | ||
|
||
import * as S from "./Checkbox.styled"; | ||
|
||
interface CheckboxProps { | ||
isChecked: boolean; | ||
} | ||
|
||
const Checkbox = ({ | ||
isChecked, | ||
...props | ||
}: React.InputHTMLAttributes<HTMLInputElement> & CheckboxProps) => { | ||
return ( | ||
<S.Layout $isChecked={isChecked ?? false}> | ||
<S.Checkbox type="checkbox" {...props} /> | ||
{isChecked && <Icon size="15" color={PRIMITIVE_COLORS.white} iconType="check" />} | ||
</S.Layout> | ||
); | ||
}; | ||
|
||
export default Checkbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import Chip from "./Chip"; | ||
|
||
const meta = { | ||
title: "common/Chip", | ||
component: Chip, | ||
parameters: { | ||
layout: "centered", | ||
docs: { | ||
description: { | ||
component: "투룻에서 사용하는 칩 컴포넌트로, isSelected로 색상 구분", | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
label: { | ||
description: "태그 라벨", | ||
control: { | ||
type: "select", | ||
}, | ||
options: ["🏡 가족", "🐾 반려동물", "⛱️ 여름", "💕 연인", "🍴 맛집", "🚶 도보"], | ||
}, | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof Chip>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
isSelected: false, | ||
label: "🐾 반려동물", | ||
}, | ||
}; | ||
|
||
export const Selected: Story = { | ||
args: { | ||
isSelected: true, | ||
label: "🐾 반려동물", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { css } from "@emotion/react"; | ||
import styled from "@emotion/styled"; | ||
|
||
import theme from "@styles/theme"; | ||
import { PRIMITIVE_COLORS } from "@styles/tokens"; | ||
|
||
const getButtonColorStyling = (isSelected: boolean) => { | ||
if (isSelected) { | ||
return css` | ||
border: 0.1rem solid ${PRIMITIVE_COLORS.blue[200]}; | ||
background-color: ${PRIMITIVE_COLORS.blue[50]}; | ||
color: ${theme.colors.primary}; | ||
`; | ||
} else { | ||
return css` | ||
border: 0.1rem solid ${theme.colors.border}; | ||
background-color: ${PRIMITIVE_COLORS.white}; | ||
color: ${theme.colors.text.secondary}; | ||
`; | ||
} | ||
}; | ||
|
||
export const Chip = styled.li<{ $isSelected: boolean }>` | ||
padding: 0.8rem 1.6rem; | ||
border-radius: 1rem; | ||
line-height: 1; | ||
${({ $isSelected }) => getButtonColorStyling($isSelected)}; | ||
`; |
Oops, something went wrong.