Skip to content

Commit

Permalink
feat: Text 컴포넌트 제작
Browse files Browse the repository at this point in the history
  • Loading branch information
SeieunYoo committed Aug 12, 2024
1 parent b3995e8 commit af39bbf
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 4 deletions.
1 change: 1 addition & 0 deletions apps/admin/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "./global.css";
import "wowds-ui/styles.css";
import "@wow-class/ui/styles.css";

import type { Metadata } from "next";
import localFont from "next/font/local";
Expand Down
5 changes: 4 additions & 1 deletion apps/admin/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { styled } from "@styled-system/jsx";
import { Button } from "@wow-class/ui";
import { Button, Text } from "@wow-class/ui";

const Home = () => {
return (
Expand All @@ -8,6 +8,9 @@ const Home = () => {
<Button appName="admin">버튼</Button>
<styled.div color="red.300">sdf</styled.div>
<styled.div color="mono.100">sdf</styled.div>
<Text color="error" typo="h1">
헤딩1
</Text>
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions apps/client/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "./global.css";
import "wowds-ui/styles.css";
import "@wow-class/ui/styles.css";

import type { Metadata } from "next";
import localFont from "next/font/local";
Expand Down
5 changes: 4 additions & 1 deletion apps/client/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { styled } from "@styled-system/jsx";
import { Button } from "@wow-class/ui";
import { Button, Text } from "@wow-class/ui";

const Home = () => {
return (
Expand All @@ -8,6 +8,9 @@ const Home = () => {
<Button appName="admin">버튼</Button>
<styled.div color="blue.100">sdf</styled.div>
<styled.div color="yellow.500">sdf</styled.div>
<Text color="primary" typo="h1">
헤딩1
</Text>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"baseUrl": ".",
"paths": {
"@/*": ["app/*"],
"@styled-system/*": ["./styled-system/*"],
"@styled-system/*": ["./styled-system/*"]
}
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"node": ">=18"
},
"dependencies": {
"wowds-tokens": "^0.1.1",
"wowds-ui": "^0.1.8"
}
}
3 changes: 2 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"exports": {
".": "./src/components/index.ts"
".": "./src/components/index.ts",
"./styles.css": "./dist/styles.css"
},
"scripts": {
"lint": "eslint . --max-warnings 0",
Expand Down
11 changes: 11 additions & 0 deletions packages/ui/panda.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import { defineConfig } from "@pandacss/dev";
import commonConfig from "@wow-class/panda-config/common-config";

import { typography } from "wowds-tokens";

export default defineConfig({
...commonConfig,
staticCss: {
css: [
{
properties: {
textStyle: Object.keys(typography),
},
},
],
},
dependencies: ["./src/components/**"],
include: ["./src/**/*.{ts,tsx,js,jsx}"],
});
34 changes: 34 additions & 0 deletions packages/ui/src/components/Text/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { css } from "@styled-system/css";
import { styled } from "@styled-system/jsx";
import type { ColorToken } from "@styled-system/tokens";
import type { CSSProperties, PropsWithChildren } from "react";
import type { typography as typoType } from "wowds-tokens";

type ColorKey = ColorToken;
type TypoKey = keyof typeof typoType;

interface TextProps extends PropsWithChildren {
typo?: TypoKey;
color?: ColorKey;
style?: CSSProperties;
className?: string;
}

export const Text = ({
typo = "body0",
color = "blue.100",
children,
...rest
}: TextProps) => {
return (
<styled.p
className={css({
textStyle: typo,
color: color,
})}
{...rest}
>
{children}
</styled.p>
);
};
1 change: 1 addition & 0 deletions packages/ui/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./Button";
export * from "./Modal";
export * from "./Text";
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit af39bbf

Please sign in to comment.