Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/#36: Text 컴포넌트 HTMLAttributes 타입 확장 및 Theme Font 값 추가 #37

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
23 changes: 19 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "concept-be-design-system",
"description": "컨셉비 디자인 시스템",
"version": "0.5.3",
"version": "0.5.13",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';

import { Alert, BottomSheet, Button, Confirm } from '.';
import { Alert, BottomSheet, Button, Confirm, Text } from '.';

const App = () => {
const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false);
Expand All @@ -10,7 +10,7 @@ const App = () => {
return (
<>
<Button onClick={() => setIsBottomSheetOpen(true)}>Bottom Sheet</Button>

<Text font="suit10eb">피드</Text>
<BottomSheet
isOpen={isBottomSheetOpen}
onClose={() => setIsBottomSheetOpen(false)}
Expand Down
9 changes: 9 additions & 0 deletions src/assets/svg/write_pencil.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Badge = <T extends ElementType>({
children,
backgroundColor = 'bg1',
fontColor = 'b9',
radius = 4,
radius = 50,
...attributes
}: Props<T>) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const BottomSheetWrapper = styled.div<{ isOpen: boolean }>`
margin: 0 auto;
width: auto;
max-width: 420px;
max-height: 90%;
max-height: 70%;
min-height: 70%;
background-color: #fff;
box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2);
Expand Down
3 changes: 1 addition & 2 deletions src/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ const NavWrapper = styled.nav`
position: absolute;
bottom: 8%;
display: flex;
justify-content: space-between;
gap: 20%;
justify-content: space-around;
`;
4 changes: 2 additions & 2 deletions src/components/Navigation/NavigationItem.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { ReactNode } from 'react';
import { HtmlHTMLAttributes, ReactNode } from 'react';

type PositionType = 'normal' | 'center';

export interface Props {
export interface Props extends HtmlHTMLAttributes<HTMLDivElement> {
onClick?: () => void;
position?: PositionType;
children: ReactNode;
Expand Down
3 changes: 2 additions & 1 deletion src/components/Tag/Tag.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import styled from '@emotion/styled';

import { HTMLAttributes } from 'react';
import { ReactComponent as SVGCancel } from '../../assets/svg/cancel.svg';
import Spacer from '../Spacer/Spacer';
import Text from '../Text/Text';

interface TagProps {
interface TagProps extends HTMLAttributes<HTMLDivElement> {
children: string;
onDelete: (name: string) => void;
}
Expand Down
8 changes: 5 additions & 3 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import styled from '@emotion/styled';
import {
ReactNode,
ElementType,
ComponentPropsWithoutRef,
CSSProperties,
ElementType,
HTMLAttributes,
ReactNode,
} from 'react';

import { ReactComponent as SVGTextRequired } from '../../assets/svg/text_required.svg';
Expand All @@ -16,7 +17,8 @@ type Props<T extends ElementType> = {
color?: ColorKeyType;
required?: boolean;
wordBreak?: CSSProperties['wordBreak'];
} & ComponentPropsWithoutRef<T>;
} & ComponentPropsWithoutRef<T> &
HTMLAttributes<T>;

const Text = <T extends ElementType>({
as,
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export { ReactComponent as SVGScrap24 } from './assets/svg/scrap_24.svg';
export { ReactComponent as SVGScrapFilled24 } from './assets/svg/scrap_filled_24.svg';
export { ReactComponent as SVGTextRequired } from './assets/svg/text_required.svg';
export { ReactComponent as SVGTripleDots } from './assets/svg/triple_dots.svg';
export { ReactComponent as SVGWritePencil } from './assets/svg/write_pencil.svg';

export { ReactComponent as SVGHeaderBack24B } from './assets/svg/header/back_24_B.svg';
export { ReactComponent as SVGHeaderBack24W } from './assets/svg/header/back_24_W.svg';
Expand Down
12 changes: 8 additions & 4 deletions src/stories/SVGCommon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import {
SVGAdd24,
SVGCancel,
SVGCheckFilled24,
SVGDropdownArrow,
SVGFeed24,
SVGFeedFilled24,
SVGGoldBell,
SVGProfile24,
SVGProfileFilled24,
SVGRadioCheck24,
SVGRadioFilled24,
SVGRadioUncheck24,
SVGScrap24,
SVGScrapFilled24,
SVGRadioUncheck24,
SVGRadioFilled24,
SVGRadioCheck24,
SVGTextRequired,
SVGTripleDots,
SVGDropdownArrow,
SVGWritePencil,
} from '../.';

const meta = {
Expand Down Expand Up @@ -44,6 +46,8 @@ export const Default: Story = {
<SVGRadioCheck24 />
<SVGTextRequired />
<SVGTripleDots />
<SVGGoldBell />
<SVGWritePencil />
</div>
),
};
18 changes: 13 additions & 5 deletions src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const color = {
} as const;

const font = {
suit10eb: {
fontSize: 10,
fontWeight: 800,
},
suit12r: {
fontSize: 12,
fontWeight: 400,
Expand Down Expand Up @@ -47,15 +51,15 @@ const font = {
fontSize: 14,
fontWeight: 600,
},
suit14sb: {
fontSize: 14,
fontWeight: 600,
},
suit14b: {
fontSize: 14,
fontWeight: 700,
},
suit15ra: {
fontSize: 15,
fontWeight: 400,
},
suit15rb: {
suit15r: {
fontSize: 15,
fontWeight: 400,
},
Expand All @@ -67,6 +71,10 @@ const font = {
fontSize: 15,
fontWeight: 600,
},
suit16r: {
fontSize: 16,
fontWeight: 400,
},
suit16m: {
fontSize: 16,
fontWeight: 500,
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5268,7 +5268,7 @@ eslint-module-utils@^2.7.4, eslint-module-utils@^2.8.0:
dependencies:
debug "^3.2.7"

eslint-plugin-import@*, eslint-plugin-import@^2.28.1, eslint-plugin-import@>=1.4.0:
eslint-plugin-import@*, eslint-plugin-import@>=1.4.0:
version "2.28.1"
resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz"
integrity sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==
Expand Down
Loading