Skip to content

Commit 183d99e

Browse files
authored
merge: iOS, AOS, Storybook 프리텐다드 글꼴 적용 (#1)
merge: iOS, AOS, Storybook 프리텐다드 글꼴 적용 (#1)
2 parents f31250e + 6565730 commit 183d99e

File tree

20 files changed

+225
-5
lines changed

20 files changed

+225
-5
lines changed

.yarn/install-state.gz

14.1 KB
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
@tailwind base;
22
@tailwind components;
33
@tailwind utilities;
4+
5+
@font-face {
6+
font-family: 'Pretendard-Medium';
7+
src: url('https://fastly.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Medium.woff')
8+
format('woff');
9+
font-style: normal;
10+
}
11+
12+
@font-face {
13+
font-family: 'Pretendard-Light';
14+
src: url('https://fastly.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Light.woff')
15+
format('woff');
16+
font-style: normal;
17+
}
18+
19+
@font-face {
20+
font-family: 'Pretendard-Bold';
21+
src: url('https://fastly.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Bold.woff')
22+
format('woff');
23+
font-style: normal;
24+
}

packages/design-system/.storybook/preview.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ const preview: Preview = {
99
date: /Date$/i,
1010
},
1111
},
12+
backgrounds: {
13+
default: 'gray',
14+
values: [
15+
{
16+
name: 'gray',
17+
value: '#F3F5FB',
18+
},
19+
{
20+
name: 'white',
21+
value: '#FFFFFF',
22+
},
23+
{
24+
name: 'black',
25+
value: '#000000',
26+
},
27+
],
28+
},
1229
},
1330
};
1431

packages/design-system/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './src/Button';
2+
export * from './src/Font';

packages/design-system/src/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export const Button = ({ text, onPress }: ButtonProps) => (
1212
onPress={onPress}
1313
activeOpacity={0.8}
1414
>
15-
<Text className="text-white text-base font-bold">{text}</Text>
15+
<Text className="text-white text-base font-pb">{text}</Text>
1616
</TouchableOpacity>
1717
);

packages/design-system/src/Font.tsx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { ReactNode } from 'react';
2+
import { Text } from 'react-native';
3+
4+
const FONT_PREFIX = {
5+
MEDIUM: 'font-Pretendard-Medium',
6+
BOLD: 'font-Pretendard-Bold',
7+
LIGHT: 'font-Pretendard-Light',
8+
} as const;
9+
10+
const COLOR_PREFIX = {
11+
red: 'text-SPOT-red',
12+
black: 'text-SPOT-black',
13+
white: 'text-SPOT-white',
14+
} as const;
15+
16+
const FONT_TYPE_PREFIX = {
17+
body1: 'text-base leading-6',
18+
title1: 'text-[1.375rem] leading-[1.875rem]',
19+
};
20+
21+
type Color = keyof typeof COLOR_PREFIX;
22+
type FontType = keyof typeof FONT_TYPE_PREFIX;
23+
24+
interface FontProps {
25+
children: ReactNode;
26+
type: FontType;
27+
color: Color;
28+
}
29+
30+
const FontBase = ({ type, color, children }: FontProps) => {
31+
const fontType = FONT_TYPE_PREFIX[type];
32+
const colorStyle = COLOR_PREFIX[color];
33+
const fontStyle = FONT_PREFIX.MEDIUM;
34+
return (
35+
<Text className={`${fontStyle} ${fontType} ${colorStyle}`}>{children}</Text>
36+
);
37+
};
38+
39+
const FontBold = ({ type, color, children }: FontProps) => {
40+
const fontType = FONT_TYPE_PREFIX[type];
41+
const colorStyle = COLOR_PREFIX[color];
42+
const fontStyle = FONT_PREFIX.BOLD;
43+
return (
44+
<Text className={`${fontStyle} ${fontType} ${colorStyle}`}>{children}</Text>
45+
);
46+
};
47+
48+
const FontLight = ({ type, color, children }: FontProps) => {
49+
const fontType = FONT_TYPE_PREFIX[type];
50+
const colorStyle = COLOR_PREFIX[color];
51+
const fontStyle = FONT_PREFIX.LIGHT;
52+
53+
return (
54+
<Text className={`${fontType} ${fontStyle} ${colorStyle}`}>{children}</Text>
55+
);
56+
};
57+
58+
const Font = Object.assign(FontBase, {
59+
Bold: FontBold,
60+
Light: FontLight,
61+
});
62+
63+
export default Font;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import Font from '../src/Font';
3+
4+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
5+
const meta = {
6+
title: 'Example/Font',
7+
component: Font,
8+
parameters: {
9+
layout: 'centered',
10+
},
11+
tags: ['autodocs'],
12+
13+
args: {},
14+
} satisfies Meta<typeof Font>;
15+
16+
export default meta;
17+
type Story = StoryObj<typeof meta>;
18+
19+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
20+
export const defaultStory: Story = {
21+
args: {
22+
type: 'body1',
23+
children: '프리텐다드',
24+
color: 'red',
25+
},
26+
};
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)