-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c57ea8
commit 4333ce2
Showing
37 changed files
with
1,229 additions
and
408 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import { Theme } from '@/styles/Theme'; | ||
|
||
export interface BoxStylingProps { | ||
width?: string; | ||
height?: string; | ||
margin?: string; | ||
marginRight?: string; | ||
marginTop?: string; | ||
marginLeft?: string; | ||
marginBottom?: string; | ||
padding?: string; | ||
paddingTop?: string; | ||
paddingRight?: string; | ||
paddingBottom?: string; | ||
paddingLeft?: string; | ||
border?: string; | ||
borderRadius?: string; | ||
borderColor?: string; | ||
borderTop?: string; | ||
borderRight?: string; | ||
borderBottom?: string; | ||
borderLeft?: string; | ||
backgroundColor?: string; | ||
color?: string; | ||
position?: 'static' | 'absolute' | 'relative' | 'fixed' | 'inherit'; | ||
} | ||
|
||
export const getBoxStyling = ({ | ||
width = '', | ||
height = '', | ||
margin = '', | ||
marginRight = '', | ||
marginTop = '', | ||
marginLeft = '', | ||
marginBottom = '', | ||
padding = '', | ||
paddingTop = '', | ||
paddingRight = '', | ||
paddingBottom = '', | ||
paddingLeft = '', | ||
border = '', | ||
borderRadius = '', | ||
borderColor = `${Theme.color.black200}`, | ||
borderTop = '', | ||
borderRight = '', | ||
borderBottom = '', | ||
borderLeft = '', | ||
backgroundColor = '', | ||
color = '', | ||
position = 'static', | ||
}: BoxStylingProps) => | ||
css({ | ||
width, | ||
height, | ||
margin, | ||
marginRight, | ||
marginTop, | ||
marginLeft, | ||
marginBottom, | ||
padding, | ||
paddingTop, | ||
paddingRight, | ||
paddingBottom, | ||
paddingLeft, | ||
border, | ||
borderRadius, | ||
borderColor, | ||
borderTop, | ||
borderRight, | ||
borderBottom, | ||
borderLeft, | ||
backgroundColor, | ||
color, | ||
position, | ||
}); |
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,33 @@ | ||
import type { ComponentPropsWithoutRef, ElementType } from 'react'; | ||
|
||
import type { BoxStylingProps } from '@/components/Common/Box/Box.styled.ts'; | ||
|
||
import { getBoxStyling } from '@/components/Common/Box/Box.styled.ts'; | ||
|
||
export interface BoxProps extends ComponentPropsWithoutRef<'div'> { | ||
/** | ||
* Box 컴포넌트가 사용할 HTML 태그 | ||
* | ||
* @default 'div' | ||
*/ | ||
tag?: ElementType; | ||
/** Box 컴포넌트 스타일 옵션 */ | ||
styles?: BoxStylingProps; | ||
} | ||
|
||
const Box = ({ | ||
tag = 'div', | ||
styles = {}, | ||
children, | ||
...attributes | ||
}: BoxProps) => { | ||
const Tag = tag; | ||
|
||
return ( | ||
<Tag css={getBoxStyling(styles)} {...attributes}> | ||
{children} | ||
</Tag> | ||
); | ||
}; | ||
|
||
export default Box; |
61 changes: 61 additions & 0 deletions
61
src/components/Common/CalendarLabel/CalendarLabel.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,61 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import type { CalendarLabelProps } from './CalendarLabel'; | ||
|
||
import { LabelColorType, Theme } from '@/styles/Theme.ts'; | ||
|
||
export const getCalendarLabelStyling = () => { | ||
return css({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: 'fit-content', | ||
height: '2.25rem', | ||
minWidth: '3.5rem', | ||
padding: '0.25rem 0.75rem', | ||
|
||
borderWidth: '1px', | ||
borderStyle: 'solid', | ||
}); | ||
}; | ||
|
||
export const getCalendarLabelVariantStyling = ( | ||
variant: Required<CalendarLabelProps>['$variant'], | ||
) => { | ||
const style = { | ||
background: css({ | ||
color: Theme.color.white, | ||
}), | ||
border: css({ | ||
color: Theme.color.black, | ||
|
||
background: 'none', | ||
}), | ||
}; | ||
|
||
return style[variant]; | ||
}; | ||
|
||
export const getCalendarLabelBorderStyling = ( | ||
border: Required<CalendarLabelProps>['$rounded'], | ||
) => { | ||
const style = { | ||
small: css({ | ||
borderRadius: Theme.borderRadius.small, | ||
}), | ||
medium: css({ | ||
borderRadius: Theme.borderRadius.medium, | ||
}), | ||
large: css({ | ||
borderRadius: Theme.borderRadius.large, | ||
}), | ||
}; | ||
return style[border]; | ||
}; | ||
|
||
export const getCalendarLabelColorStyling = (color: LabelColorType) => { | ||
return css({ | ||
borderColor: Theme.labelColor[color], | ||
backgroundColor: Theme.labelColor[color], | ||
}); | ||
}; |
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,66 @@ | ||
import { ComponentPropsWithRef, ElementType } from 'react'; | ||
|
||
import { | ||
getCalendarLabelBorderStyling, | ||
getCalendarLabelColorStyling, | ||
getCalendarLabelStyling, | ||
getCalendarLabelVariantStyling, | ||
} from './CalendarLabel.styled'; | ||
|
||
import { LabelColorType } from '@/styles/Theme'; | ||
|
||
export interface CalendarLabelProps extends ComponentPropsWithRef<'div'> { | ||
/** | ||
* 사용할 HTML 태그 유형을 지정합니다. | ||
* | ||
* @default: 'div' | ||
*/ | ||
tag?: ElementType; | ||
/** | ||
* 라벨에 표시될 텍스트를 지정합니다. | ||
*/ | ||
text: string; | ||
/** | ||
* 라벨의 모서리 스타일을 지정합니다. | ||
* | ||
* @default: 'medium' | ||
*/ | ||
$rounded?: 'small' | 'medium' | 'large'; | ||
/** | ||
* 라벨의 스타일 변형을 지정합니다. | ||
* | ||
* @default: 'background' | ||
*/ | ||
$variant?: 'background' | 'border'; | ||
/** | ||
* 라벨의 색상을 지정합니다. | ||
*/ | ||
$color: LabelColorType; | ||
} | ||
|
||
function CalendarLabel({ | ||
tag = 'div', | ||
$rounded = 'medium', | ||
$variant = 'background', | ||
$color, | ||
text, | ||
...attributes | ||
}: CalendarLabelProps) { | ||
const Tag: ElementType = tag; | ||
|
||
return ( | ||
<Tag | ||
css={[ | ||
getCalendarLabelStyling, | ||
getCalendarLabelBorderStyling($rounded), | ||
getCalendarLabelColorStyling($color), | ||
getCalendarLabelVariantStyling($variant), | ||
]} | ||
{...attributes} | ||
> | ||
{text} | ||
</Tag> | ||
); | ||
} | ||
|
||
export default CalendarLabel; |
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,12 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
export const getCenterStyling = css({ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
|
||
width: '100%', | ||
height: '100%', | ||
|
||
textAlign: 'center', | ||
}); |
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,24 @@ | ||
import type { ComponentPropsWithoutRef, ElementType } from 'react'; | ||
|
||
import { getCenterStyling } from '@/components/Common/Center/Center.styled'; | ||
|
||
export interface CenterProps extends ComponentPropsWithoutRef<'div'> { | ||
/** | ||
* Center 컴포넌트가 사용할 HTML 태그 | ||
* | ||
* @default 'div' | ||
*/ | ||
tag?: ElementType; | ||
} | ||
|
||
const Center = ({ tag = 'div', children, ...attributes }: CenterProps) => { | ||
const Tag = tag; | ||
|
||
return ( | ||
<Tag css={getCenterStyling} {...attributes}> | ||
{children} | ||
</Tag> | ||
); | ||
}; | ||
|
||
export default Center; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import { LabelColorType, Theme } from '@/styles/Theme.ts'; | ||
|
||
export const getLabelButtonColorStyling = ( | ||
isSelected: boolean, | ||
color: LabelColorType, | ||
) => { | ||
return css({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: 'fit-content', | ||
height: '2.25rem', // Tailwind's h-9 | ||
minWidth: '3.5rem', // Tailwind's min-w-14 | ||
padding: '0.25rem 0.75rem', // Tailwind's px-3 py-1 | ||
borderRadius: '9999px', // Tailwind's rounded-full | ||
|
||
fontWeight: 600, // Tailwind's font-semibold | ||
|
||
color: Theme.color.white, | ||
cursor: 'pointer', | ||
|
||
border: '1px solid', | ||
|
||
borderColor: !isSelected ? Theme.labelColor[color] : undefined, | ||
backgroundColor: isSelected ? Theme.labelColor[color] : undefined, | ||
}); | ||
}; |
Oops, something went wrong.