diff --git a/.eslintrc b/.eslintrc index 781610d..1be8796 100644 --- a/.eslintrc +++ b/.eslintrc @@ -22,7 +22,7 @@ "jsx": true } }, - "ignorePatterns": ["*.config.ts"], + "ignorePatterns": ["*.config.ts", "*.config.d.ts"], "extends": [ "eslint:recommended", "plugin:react/recommended", diff --git a/.gitignore b/.gitignore index a44b0ff..42e78ef 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,4 @@ storybook-static *storybook.log -.DS_Store \ No newline at end of file +.DS_Store diff --git a/.husky/pre-commit b/.husky/pre-commit index 6c75c86..c2f5bc0 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,8 +1,8 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npm run format -npm run lint -npm run build -npm run test +npm run format:fix +# npm run lint +# npm run build +# npm run test git add . \ No newline at end of file diff --git a/package.json b/package.json index 4ab5a80..5d50ec6 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,14 @@ "lint:icons": "eslint . --ext .ts,.tsx --ignore-path .gitignore --fix", "format": "prettier --write --parser typescript '**/*.{ts,tsx}' --ignore-path .ignoreicons", "lint": "eslint . --ext .ts,.tsx --ignore-path .ignoreicons --fix", - "build": "tsc -p tsconfig.json && vite build && cp ./tailwind.config.ts ./dist/ && tsc -p tsconfig-dist.json", + "build": "tsc -p tsconfig.json && cp ./tailwind.config.ts ./public/ && tsc -p tsconfig-dist.json && vite build", + "build:watch": "tsc -p tsconfig.json && cp ./tailwind.config.ts ./public/ && tsc -p tsconfig-dist.json && vite build --watch", "test": "vitest run", "test-watch": "vitest", "test:ui": "vitest --ui", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", + "format:fix": "npm run ci:format", "ci:format": "npm run format && npm run lint", "ci:format:icons": "npm run format:icons && npm run lint:icons", "prepare": "husky", diff --git a/public/tailwind.config.d.ts b/public/tailwind.config.d.ts new file mode 100644 index 0000000..556cbd6 --- /dev/null +++ b/public/tailwind.config.d.ts @@ -0,0 +1,304 @@ +export declare const DreamPipColors: { + transparent: string; + logo: { + light: { + st0: string; + st1: string; + st2: string; + st3: string; + st4: string; + st5: string; + st6: string; + st7: string; + }; + dark: { + st0: string; + st1: string; + st2: string; + st3: string; + st4: string; + st5: string; + st6: string; + st7: string; + }; + }; + card: { + white: string; + soft: string; + dark: string; + foggy: string; + }; + icon: { + light: { + primary: string; + secondary: string; + bw: string; + white: string; + }; + dark: { + primary: string; + secondary: string; + bw: string; + white: string; + }; + }; + primary: { + light: string; + contrast: string; + dark: string; + passion: string; + passionLight: string; + passionSoft: string; + soft: string; + green: string; + white: string; + }; + secondary: { + light: string; + constrast: string; + dark: string; + passion: string; + passionLight: string; + passionSoft: string; + soft: string; + }; + gradient: { + soft: { + light: { + from: string; + to: string; + }; + dark: { + from: string; + to: string; + }; + }; + }; + soft: { + light: string; + constrast: string; + bg: string; + dark: string; + }; + outro: { + light: string; + dark: string; + }; + body: { + primary: string; + light: string; + dark: string; + passion: string; + }; + inverse: { + light: string; + dark: string; + }; + neutral: { + light: string; + dark: string; + }; +}; +declare const _default: { + content: string[]; + important: string; + safelist: string[]; + theme: { + colors: { + transparent: string; + logo: { + light: { + st0: string; + st1: string; + st2: string; + st3: string; + st4: string; + st5: string; + st6: string; + st7: string; + }; + dark: { + st0: string; + st1: string; + st2: string; + st3: string; + st4: string; + st5: string; + st6: string; + st7: string; + }; + }; + card: { + white: string; + soft: string; + dark: string; + foggy: string; + }; + icon: { + light: { + primary: string; + secondary: string; + bw: string; + white: string; + }; + dark: { + primary: string; + secondary: string; + bw: string; + white: string; + }; + }; + primary: { + light: string; + contrast: string; + dark: string; + passion: string; + passionLight: string; + passionSoft: string; + soft: string; + green: string; + white: string; + }; + secondary: { + light: string; + constrast: string; + dark: string; + passion: string; + passionLight: string; + passionSoft: string; + soft: string; + }; + gradient: { + soft: { + light: { + from: string; + to: string; + }; + dark: { + from: string; + to: string; + }; + }; + }; + soft: { + light: string; + constrast: string; + bg: string; + dark: string; + }; + outro: { + light: string; + dark: string; + }; + body: { + primary: string; + light: string; + dark: string; + passion: string; + }; + inverse: { + light: string; + dark: string; + }; + neutral: { + light: string; + dark: string; + }; + }; + fontSize: { + sm: string; + md: string; + base: string; + xl: string; + '1xl': string; + '2xl': string; + '3xl': string; + '4xl': string; + '5xl': string; + }; + letterSpacing: { + a0: string; + a1: string; + a2: string; + a3: string; + a4: string; + a5: string; + a6: string; + b0: string; + b1: string; + b2: string; + b3: string; + b4: string; + b5: string; + b6: string; + }; + lineHeight: { + a0: string; + a1: string; + a2: string; + a3: string; + a4: string; + a5: string; + a6: string; + b0: string; + b1: string; + b2: string; + b3: string; + b4: string; + b5: string; + b6: string; + }; + spacing: { + 0: string; + a0: string; + a1: string; + a2: string; + a3: string; + a4: string; + a5: string; + a6: string; + a7: string; + a8: string; + a9: string; + b0: string; + b1: string; + b2: string; + b3: string; + b4: string; + b5: string; + b6: string; + }; + sizing: { + 0: string; + a0: string; + a1: string; + a2: string; + a3: string; + a4: string; + a5: string; + a6: string; + a7: string; + a8: string; + a9: string; + b0: string; + b1: string; + b2: string; + b3: string; + b4: string; + b5: string; + b6: string; + }; + aspectRatio: { + square: string; + blog: string; + tv: string; + cinema: string; + }; + }; + plugins: any[]; + corePlugins: { + preflight: false; + }; + darkMode: ['variant', string]; +}; +export default _default; diff --git a/public/tailwind.config.js b/public/tailwind.config.js new file mode 100644 index 0000000..5736b9d --- /dev/null +++ b/public/tailwind.config.js @@ -0,0 +1,272 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DreamPipColors = void 0; +// spacing +var base = 8; +var inc00 = 0; +var inc00a = base * 0.5; // 4 +var inc01a = base; // 8 +var inc02a = base * 2; // 16 +var inc03a = base * 3; // 24 +var inc04a = base * 4; // 32 +var inc05a = base * 5; // 40 +var inc06a = base * 6; // 48 +var inc07a = base * 7; // 56 +var inc08a = base * 8; // 64 +var inc09a = base * 9; // 72 +var inc00b = base * 0.25; // 4 +var inc01b = base * 1.5; // 12 +var inc02b = base * 2.5; // 20 +var inc03b = base * 3.5; // 28 +var inc04b = base * 4.5; // 36 +var inc05b = base * 5.5; // 44 +var inc06b = base * 6.5; // 52 +// colors +var n100 = '#191919'; +var n200 = '#1b1b1b'; +var n300 = '#aaaaaa'; +var n400 = '#ffffff'; +// const n500 = '#550000'; +// const n600 = '#660000'; +var st0 = '#F69240'; +var st1 = '#F8D49A'; +var st2 = '#50A2FA'; +var st3 = '#65E9DD'; +var st4 = '#6F32D8'; +var st5 = '#83FAAF'; +var st6 = '#EB5E1D'; +var st7 = '#F8F8F8'; +var st8 = '#f4ede1'; +var dp200 = st0; // average pastel orange +var dp300 = st1; // light pastel orange +var dp400 = st2; // average pastel blue +var dp500 = st3; // light cyan +var dp600 = st4; // dark purple +var dp700 = st5; // light pastel green +var dp800 = st6; // dark orange +var dp900 = st8; // soft pastel orange +var transparent = '#00000000'; +var bg2 = dp900; +var secondary = dp200; +var primary = dp800; +var tertiary = dp800; +var dark1 = n100; +var dark2 = n200; +var passion = 'pink'; +var passionLight = '#660000'; +var passionSoft = '#880000'; +var white = '#ffffff'; +var light1 = dp300; +var light2 = dp200; +exports.DreamPipColors = { + transparent: transparent, + logo: { + light: { + st0: st0, + st1: st1, + st2: st2, + st3: st3, + st4: st4, + st5: st5, + st6: st6, + st7: dark1, + }, + dark: { + st0: st0, + st1: st1, + st2: st2, + st3: st3, + st4: st4, + st5: st5, + st6: st6, + st7: st7, + }, + }, + card: { + white: white, + soft: bg2, + dark: dark1, + foggy: dark2, + }, + icon: { + light: { + primary: primary, + secondary: secondary, + bw: n300, + white: white, + }, + dark: { + primary: primary, + secondary: secondary, + bw: white, + white: white, + }, + }, + primary: { + light: primary, + contrast: secondary, + dark: light2, + passion: passion, + passionLight: passionLight, + passionSoft: passionSoft, + soft: bg2, + green: dp700, + white: white, + }, + secondary: { + light: secondary, + constrast: light1, + dark: light2, + passion: passion, + passionLight: passionLight, + passionSoft: passionSoft, + soft: bg2, + }, + gradient: { + soft: { + light: { + from: bg2, + to: light1, + }, + dark: { + from: dark1, + to: dark2, + }, + }, + }, + soft: { + light: white, + constrast: light2, + bg: bg2, + dark: '#C9FFC4', + }, + outro: { + light: '#B473CA', + dark: '#DEBDFF', + }, + body: { + primary: primary, + light: dark2, + dark: white, + passion: passion, + }, + inverse: { + light: '#F2F2F2', + dark: '#353535', + }, + neutral: { + light: n200, + dark: n400, + }, +}; +exports.default = { + content: ['./index.html', './src/**/*.{js,ts,jsx,tsx,mdx}'], + important: 'body', + safelist: [ + 'bg-inverse-light', + 'bg-inverse-dark', + 'dark:bg-inverse-dark', + 'col-span-6', + 'col-start-1', + 'md:col-span-4', + 'md:col-start-3', + 'overflow-scroll', + ], + theme: { + colors: exports.DreamPipColors, + fontSize: { + sm: '10px', + md: '14px', + base: '16px', + xl: '18px', + '1xl': '20px', + '2xl': '22px', + '3xl': '26px', + '4xl': '32px', + '5xl': '40px', + }, + letterSpacing: { + a0: "".concat(inc00a / 100, "rem"), + a1: "".concat(inc01a / 100, "rem"), + a2: "".concat(inc02a / 100, "rem"), + a3: "".concat(inc03a / 100, "rem"), + a4: "".concat(inc04a / 100, "rem"), + a5: "".concat(inc05a / 100, "rem"), + a6: "".concat(inc06a / 100, "rem"), + b0: "".concat(inc00b / 100, "rem"), + b1: "".concat(inc01b / 100, "rem"), + b2: "".concat(inc02b / 100, "rem"), + b3: "".concat(inc03b / 100, "rem"), + b4: "".concat(inc04b / 100, "rem"), + b5: "".concat(inc05b / 100, "rem"), + b6: "".concat(inc06b / 100, "rem"), + }, + lineHeight: { + a0: "".concat(inc00a, "px"), + a1: "".concat(inc01a, "px"), + a2: "".concat(inc02a, "px"), + a3: "".concat(inc03a, "px"), + a4: "".concat(inc04a, "px"), + a5: "".concat(inc05a, "px"), + a6: "".concat(inc06a, "px"), + b0: "".concat(inc00b, "px"), + b1: "".concat(inc01b, "px"), + b2: "".concat(inc02b, "px"), + b3: "".concat(inc03b, "px"), + b4: "".concat(inc04b, "px"), + b5: "".concat(inc05b, "px"), + b6: "".concat(inc06b, "px"), + }, + spacing: { + 0: '0px', + a0: "".concat(inc00a, "px"), + a1: "".concat(inc01a, "px"), + a2: "".concat(inc02a, "px"), + a3: "".concat(inc03a, "px"), + a4: "".concat(inc04a, "px"), + a5: "".concat(inc05a, "px"), + a6: "".concat(inc06a, "px"), + a7: "".concat(inc07a, "px"), + a8: "".concat(inc08a, "px"), + a9: "".concat(inc09a, "px"), + b0: "".concat(inc00b, "px"), + b1: "".concat(inc01b, "px"), + b2: "".concat(inc02b, "px"), + b3: "".concat(inc03b, "px"), + b4: "".concat(inc04b, "px"), + b5: "".concat(inc05b, "px"), + b6: "".concat(inc06b, "px"), + }, + sizing: { + 0: '0px', + a0: "".concat(inc00a, "px"), + a1: "".concat(inc01a, "px"), + a2: "".concat(inc02a, "px"), + a3: "".concat(inc03a, "px"), + a4: "".concat(inc04a, "px"), + a5: "".concat(inc05a, "px"), + a6: "".concat(inc06a, "px"), + a7: "".concat(inc07a, "px"), + a8: "".concat(inc08a, "px"), + a9: "".concat(inc09a, "px"), + b0: "".concat(inc00b, "px"), + b1: "".concat(inc01b, "px"), + b2: "".concat(inc02b, "px"), + b3: "".concat(inc03b, "px"), + b4: "".concat(inc04b, "px"), + b5: "".concat(inc05b, "px"), + b6: "".concat(inc06b, "px"), + }, + aspectRatio: { + square: '1 / 1', + blog: '3 / 2', + tv: '4 / 3', + cinema: '16 / 9', + }, + }, + plugins: [], + corePlugins: { + preflight: false, + }, + darkMode: ['variant', '.dark &:not(.dark .light *, .light .light *)'], +}; diff --git a/public/tailwind.config.ts b/public/tailwind.config.ts new file mode 100644 index 0000000..58cde07 --- /dev/null +++ b/public/tailwind.config.ts @@ -0,0 +1,286 @@ +/* eslint no-unused-vars:0, @typescript-eslint/no-unused-vars:0 */ +/** @type {import('tailwindcss').Config} */ +import type { Config } from 'tailwindcss'; + +// spacing +const base = 8; + +const inc00 = 0; +const inc00a = base * 0.5; // 4 +const inc01a = base; // 8 +const inc02a = base * 2; // 16 +const inc03a = base * 3; // 24 +const inc04a = base * 4; // 32 +const inc05a = base * 5; // 40 +const inc06a = base * 6; // 48 +const inc07a = base * 7; // 56 +const inc08a = base * 8; // 64 +const inc09a = base * 9; // 72 + +const inc00b = base * 0.25; // 4 +const inc01b = base * 1.5; // 12 +const inc02b = base * 2.5; // 20 +const inc03b = base * 3.5; // 28 +const inc04b = base * 4.5; // 36 +const inc05b = base * 5.5; // 44 +const inc06b = base * 6.5; // 52 + +// colors +const n100 = '#191919'; +const n200 = '#1b1b1b'; +const n300 = '#aaaaaa'; +const n400 = '#ffffff'; +// const n500 = '#550000'; +// const n600 = '#660000'; + +const st0 = '#F69240'; +const st1 = '#F8D49A'; +const st2 = '#50A2FA'; +const st3 = '#65E9DD'; +const st4 = '#6F32D8'; +const st5 = '#83FAAF'; +const st6 = '#EB5E1D'; +const st7 = '#F8F8F8'; +const st8 = '#f4ede1'; + +const dp200 = st0; // average pastel orange +const dp300 = st1; // light pastel orange +const dp400 = st2; // average pastel blue +const dp500 = st3; // light cyan +const dp600 = st4; // dark purple +const dp700 = st5; // light pastel green +const dp800 = st6; // dark orange +const dp900 = st8; // soft pastel orange + +const transparent = '#00000000'; +const bg2 = dp900; + +const secondary = dp200; +const primary = dp800; +const tertiary = dp800; + +const dark1 = n100; +const dark2 = n200; + +const passion = 'pink'; +const passionLight = '#660000'; +const passionSoft = '#880000'; + +const white = '#ffffff'; + +const light1 = dp300; +const light2 = dp200; + +export const DreamPipColors = { + transparent, + logo: { + light: { + st0, + st1, + st2, + st3, + st4, + st5, + st6, + st7: dark1, + }, + dark: { + st0, + st1, + st2, + st3, + st4, + st5, + st6, + st7, + }, + }, + card: { + white, + soft: bg2, + dark: dark1, + foggy: dark2, + }, + icon: { + light: { + primary, + secondary, + bw: n300, + white: white, + }, + dark: { + primary, + secondary, + bw: white, + white: white, + }, + }, + primary: { + light: primary, + contrast: secondary, + dark: light2, + passion, + passionLight, + passionSoft, + soft: bg2, + green: dp700, + white, + }, + secondary: { + light: secondary, + constrast: light1, + dark: light2, + passion, + passionLight, + passionSoft, + soft: bg2, + }, + gradient: { + soft: { + light: { + from: bg2, + to: light1, + }, + dark: { + from: dark1, + to: dark2, + }, + }, + }, + soft: { + light: white, + constrast: light2, + bg: bg2, + dark: '#C9FFC4', + }, + outro: { + light: '#B473CA', + dark: '#DEBDFF', + }, + body: { + primary, + light: dark2, + dark: white, + passion, + }, + inverse: { + light: '#F2F2F2', + dark: '#353535', + }, + neutral: { + light: n200, + dark: n400, + }, +}; + +export default { + content: ['./index.html', './src/**/*.{js,ts,jsx,tsx,mdx}'], + important: 'body', + safelist: [ + 'bg-inverse-light', + 'bg-inverse-dark', + 'dark:bg-inverse-dark', + 'col-span-6', + 'col-start-1', + 'md:col-span-4', + 'md:col-start-3', + 'overflow-scroll', + ], + theme: { + colors: DreamPipColors, + fontSize: { + sm: '10px', + md: '14px', + base: '16px', + xl: '18px', + '1xl': '20px', + '2xl': '22px', + '3xl': '26px', + '4xl': '32px', + '5xl': '40px', + }, + letterSpacing: { + a0: `${inc00a / 100}rem`, + a1: `${inc01a / 100}rem`, + a2: `${inc02a / 100}rem`, + a3: `${inc03a / 100}rem`, + a4: `${inc04a / 100}rem`, + a5: `${inc05a / 100}rem`, + a6: `${inc06a / 100}rem`, + b0: `${inc00b / 100}rem`, + b1: `${inc01b / 100}rem`, + b2: `${inc02b / 100}rem`, + b3: `${inc03b / 100}rem`, + b4: `${inc04b / 100}rem`, + b5: `${inc05b / 100}rem`, + b6: `${inc06b / 100}rem`, + }, + lineHeight: { + a0: `${inc00a}px`, + a1: `${inc01a}px`, + a2: `${inc02a}px`, + a3: `${inc03a}px`, + a4: `${inc04a}px`, + a5: `${inc05a}px`, + a6: `${inc06a}px`, + b0: `${inc00b}px`, + b1: `${inc01b}px`, + b2: `${inc02b}px`, + b3: `${inc03b}px`, + b4: `${inc04b}px`, + b5: `${inc05b}px`, + b6: `${inc06b}px`, + }, + spacing: { + 0: '0px', + a0: `${inc00a}px`, + a1: `${inc01a}px`, + a2: `${inc02a}px`, + a3: `${inc03a}px`, + a4: `${inc04a}px`, + a5: `${inc05a}px`, + a6: `${inc06a}px`, + a7: `${inc07a}px`, + a8: `${inc08a}px`, + a9: `${inc09a}px`, + b0: `${inc00b}px`, + b1: `${inc01b}px`, + b2: `${inc02b}px`, + b3: `${inc03b}px`, + b4: `${inc04b}px`, + b5: `${inc05b}px`, + b6: `${inc06b}px`, + }, + sizing: { + 0: '0px', + a0: `${inc00a}px`, + a1: `${inc01a}px`, + a2: `${inc02a}px`, + a3: `${inc03a}px`, + a4: `${inc04a}px`, + a5: `${inc05a}px`, + a6: `${inc06a}px`, + a7: `${inc07a}px`, + a8: `${inc08a}px`, + a9: `${inc09a}px`, + b0: `${inc00b}px`, + b1: `${inc01b}px`, + b2: `${inc02b}px`, + b3: `${inc03b}px`, + b4: `${inc04b}px`, + b5: `${inc05b}px`, + b6: `${inc06b}px`, + }, + aspectRatio: { + square: '1 / 1', + blog: '3 / 2', + tv: '4 / 3', + cinema: '16 / 9', + }, + }, + plugins: [], + corePlugins: { + preflight: false, + }, + darkMode: ['variant', '.dark &:not(.dark .light *, .light .light *)'], +} satisfies Config; diff --git a/src/atoms/01_Button/Button.tsx b/src/atoms/01_Button/Button.tsx index 963d6e3..7ac1feb 100644 --- a/src/atoms/01_Button/Button.tsx +++ b/src/atoms/01_Button/Button.tsx @@ -38,6 +38,7 @@ export interface IButton { onClick?: () => void; target?: string; href?: string; + host?: string; rel?: string; icon?: ESystemIcon; iconPosition?: EButtonIconPosition; @@ -52,6 +53,7 @@ export const HButton = function ({ buttonTheme = EButtonTheme.PRIMARY, theme = 'light', href = '', + host = 'www.dreampip.com', target = '', rel = 'noopener', icon, @@ -60,12 +62,31 @@ export const HButton = function ({ type, onClick = () => {}, }: IButton) { + const isInternal = (link: string) => + link.startsWith('web+dreampip://') || + link?.startsWith('https://www.dreampip.com') || + link?.replace('http://', '').replace('https://', '').startsWith(host) || + link.startsWith('/'); + + const toProtocol = (link: string): string => { + if (link.startsWith('https://')) { + return link?.replace('https://', 'web+dreampip://'); + } + if (link.startsWith('http://')) { + return link?.replace('http://', 'web+dreampip://'); + } + if (link.startsWith('/')) { + return `web+dreampip://${host}${link}`; + } + return link; + }; + const external = { rel, target, }; - if (!href?.startsWith('https://dreampip.com')) { + if (!isInternal(href)) { external.rel += ' noreferrer noopener'; external.target += ' _blank'; } @@ -74,7 +95,7 @@ export const HButton = function ({ { 'relative normal-case shadow-none hover:shadow-none': true, 'rounded-md w-full px-a3 py-b1': !!children, - 'rounded-md px-0 py-0 min-w-a5 max-w-a5 w-a5 max-h-a5 h-a5': !children, + 'rounded-md px-0 py-0 min-h-b5 max-w-b5 min-w-b5': !children, }, buttonTheme === EButtonTheme.PRIMARY && { [` @@ -233,6 +254,7 @@ export const HButton = function ({