Skip to content

Commit

Permalink
chore: adjust component typography (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
maulanasdqn authored Jan 13, 2024
1 parent 5565e44 commit 78adce6
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 34 deletions.
133 changes: 109 additions & 24 deletions apps/web/pmb/admin/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
18: "72px",
26: "105px",
"navbar-mobile": "160px",
navbarlg: "120px",
navbarlg: "80px",
footerHeight: "360px",
bannerLg: "520px",
},
Expand All @@ -49,39 +49,132 @@ module.exports = {
},
},
colors: {
green: {
50: "#e6f5ed",
100: "#b0dec6",
200: "#8acfaa",
300: "#54b984",
400: "#33ab6c",
500: "#009647",
},
"green-pea": {
50: "#e8eeed",
100: "#b7cac7",
200: "#94b0ab",
300: "#648c85",
400: "#45756d",
500: "#175349",
},
yellow: {
50: "#fef9e6",
100: "#fdebb1",
200: "#fce28b",
300: "#fad455",
400: "#f9cc35",
500: "#f8bf02",
},
grey: {
50: "#FAFAFA",
100: "#EFEFEF",
200: "#DCDCDC",
300: "#BDBDBD",
400: "#989898",
500: "#7C7C7C",
600: "#656565",
700: "#525252",
800: "#464646",
900: "#3D3D3D",
950: "#292929",
},
success: {
50: "#effeff6",
100: "#d9ffec",
200: "#b6fcd9",
300: "#7df8be",
400: "#3eea99",
500: "#14d379",
600: "#0bbc69",
700: "#0c894f",
800: "#0f6c41",
900: "#0f5838",
950: "#02311d",
},
warning: {
50: "#fbfde9",
100: "#f6fcc5",
200: "#f2fa8e",
300: "#f1f74d",
400: "#f3f21c",
500: "#ddd30f",
600: "#c4ac0a",
700: "#9c7d0c",
800: "#816312",
900: "#6e5015",
950: "#402B08",
},
error: {
100: "#fbe8d9",
200: "#f6cfb2",
300: "#f0ae81",
400: "#e9844e",
500: "#e3642c",
600: "#d84e1b",
700: "#b1381d",
800: "#8d2f1f",
900: "#72291c",
950: "#3d120d",
},
orange: {
100: "#fff6e8",
200: "#ffe9c8",
300: "#ffd89d",
400: "#ffc66f",
500: "#ffb444",
600: "#ffa41b",
700: "#d98b17",
800: "#b57413",
900: "#915d0f",
950: "#734a0c",
},
red: {
100: "#f8eaeb",
200: "#efcdd0",
300: "#e2a5ab",
400: "#d47b84",
500: "#c7535e",
600: "#bb2d3b",
700: "#9f2632",
800: "#85202a",
900: "#6b1a22",
950: "#54141b",
},
primary: {
green: "#009647",
blue: "#7CB9E8",
yellow: "#F8BF02",
white: "#FFFFFF",
orange: "#F78100",
black: "#000000",
},
secondary: {
green: {
0.5: "#CCEADA",
1: "#3EA136",
2: "#7CAB25",
3: "#BAB514",
4: "#175349",
5: "#113C35",
6: "#162000",
7: "#EDFFF5",
8: "#00873F",
},
sky: {
1: "#1678682E",
2: "#B9DEDA",
},
orange: {
1: "#E3642C",
2: "#eb7909",
},
yellow: {
1: "#F89602",
1: "#FBFDE9",
2: "#FFECB4",
},
},
grayscale: {
12: "#F5F5F5",
11: "#989898",
10: "#141414",
9: "#292929",
8: "#3D3D3D",
Expand All @@ -103,19 +196,11 @@ module.exports = {
4: "rgb(203 213 225)",
5: "rgb(148 163 184)",
},
red: {
1: "#ffbaba",
2: "#ff7b7b",
3: "#EAC0C4",
4: "#ff5252",
5: "#ff0000",
6: "#a70000",
7: "#BB2D3B",
},
blue: {
1: "#0CA3D2",
4: "#60FFAB",
5: "#EDFFF5",
conditional: {
disable: "#B3B3B3",
success: "#198754",
warning: "#FFC107",
error: "#BB2D3B",
},
},
},
Expand Down
109 changes: 100 additions & 9 deletions apps/web/pmb/user/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,105 @@ module.exports = {
},
},
colors: {
green: {
50: "#e6f5ed",
100: "#b0dec6",
200: "#8acfaa",
300: "#54b984",
400: "#33ab6c",
500: "#009647",
},
"green-pea": {
50: "#e8eeed",
100: "#b7cac7",
200: "#94b0ab",
300: "#648c85",
400: "#45756d",
500: "#175349",
},
yellow: {
50: "#fef9e6",
100: "#fdebb1",
200: "#fce28b",
300: "#fad455",
400: "#f9cc35",
500: "#f8bf02",
},
grey: {
50: "#FAFAFA",
100: "#EFEFEF",
200: "#DCDCDC",
300: "#BDBDBD",
400: "#989898",
500: "#7C7C7C",
600: "#656565",
700: "#525252",
800: "#464646",
900: "#3D3D3D",
950: "#292929",
},
success: {
50: "#effeff6",
100: "#d9ffec",
200: "#b6fcd9",
300: "#7df8be",
400: "#3eea99",
500: "#14d379",
600: "#0bbc69",
700: "#0c894f",
800: "#0f6c41",
900: "#0f5838",
950: "#02311d",
},
warning: {
50: "#fbfde9",
100: "#f6fcc5",
200: "#f2fa8e",
300: "#f1f74d",
400: "#f3f21c",
500: "#ddd30f",
600: "#c4ac0a",
700: "#9c7d0c",
800: "#816312",
900: "#6e5015",
950: "#402B08",
},
error: {
100: "#fbe8d9",
200: "#f6cfb2",
300: "#f0ae81",
400: "#e9844e",
500: "#e3642c",
600: "#d84e1b",
700: "#b1381d",
800: "#8d2f1f",
900: "#72291c",
950: "#3d120d",
},
orange: {
100: "#fff6e8",
200: "#ffe9c8",
300: "#ffd89d",
400: "#ffc66f",
500: "#ffb444",
600: "#ffa41b",
700: "#d98b17",
800: "#b57413",
900: "#915d0f",
950: "#734a0c",
},
red: {
100: "#f8eaeb",
200: "#efcdd0",
300: "#e2a5ab",
400: "#d47b84",
500: "#c7535e",
600: "#bb2d3b",
700: "#9f2632",
800: "#85202a",
900: "#6b1a22",
950: "#54141b",
},
primary: {
green: "#009647",
yellow: "#F8BF02",
Expand Down Expand Up @@ -97,15 +196,7 @@ module.exports = {
4: "rgb(203 213 225)",
5: "rgb(148 163 184)",
},
red: {
1: "#ffbaba",
2: "#ff7b7b",
3: "#EAC0C4",
4: "#ff5252",
5: "#ff0000",
6: "#a70000",
7: "#BB2D3B",
},

conditional: {
disable: "#B3B3B3",
success: "#198754",
Expand Down
1 change: 1 addition & 0 deletions libs/web/components/src/atoms/documents/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./message";
export * from "./typography";
40 changes: 40 additions & 0 deletions libs/web/components/src/atoms/documents/typography/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { FC, ReactElement } from "react";
import { TTypography } from "./type";
import { match } from "ts-pattern";
import clsx from "clsx";

export const Typography: FC<TTypography> = (props): ReactElement => {
const size = match(props.size)
.with("title-1", () => "text-[76px]")
.with("title-2", () => "text-[61px]")
.with("title-3", () => "text-[49px]")
.with("title-4", () => "text-[39px]")
.with("title-5", () => "text-[31px]")
.with("subtitle-1", () => "text-[25px]")
.with("subtitle-2", () => "text-[20px]")
.with("body-1", () => "text-[16px]")
.with("body-2", () => "text-[13px]")
.with("caption", () => "text-[10px]")
.otherwise(() => "text-[16px]");

const type = clsx(size, props.className, {
"font-bold": props.variant === "bold",
"font-semibold": props.variant === "semi-bold",
"font-medium": props.variant === "medium",
"font-regular": props.variant === "reguler",
});

return match(props.size)
.with("title-1", () => <h1 className={type}>{props.children}</h1>)
.with("title-2", () => <h2 className={type}>{props.children}</h2>)
.with("title-3", () => <h3 className={type}>{props.children}</h3>)
.with("title-4", () => <h4 className={type}>{props.children}</h4>)
.with("title-5", () => <h5 className={type}>{props.children}</h5>)
.with("subtitle-1", () => <span className={type}>{props.children}</span>)
.with("subtitle-2", () => <span className={type}>{props.children}</span>)
.with("body-2", () => <p className={type}>{props.children}</p>)
.with("body-1", () => <p className={type}>{props.children}</p>)
.with("caption", () => <p className={type}>{props.children}</p>)
.with(undefined, () => <p className={type}>{props.children}</p>)
.exhaustive();
};
19 changes: 19 additions & 0 deletions libs/web/components/src/atoms/documents/typography/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DetailedHTMLProps, HTMLAttributes } from "react";

export type TTypography = DetailedHTMLProps<
HTMLAttributes<HTMLHeadingElement>,
HTMLHeadingElement
> & {
variant?: "bold" | "semi-bold" | "medium" | "reguler";
size?:
| "title-1"
| "title-2"
| "title-3"
| "title-4"
| "title-5"
| "subtitle-1"
| "subtitle-2"
| "body-1"
| "body-2"
| "caption";
};
2 changes: 1 addition & 1 deletion libs/web/components/src/atoms/forms/label/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TLabel } from "./type";
import clsx from "clsx";
export const Label: FC<TLabel> = (props): ReactElement => {
const className = clsx(
"flex gap-x-1 text-gray-500 select-none font-medium",
"flex gap-x-1 text-grey-500 select-none font-medium",
{
"text-sm": props.size === "sm",
"text-base": props.size === "md",
Expand Down

0 comments on commit 78adce6

Please sign in to comment.