Commit 968d9eb9 by Moorthy G

feat: upgrade to tailwind v4

parent a642a4f7
...@@ -4,14 +4,15 @@ import path from 'path'; ...@@ -4,14 +4,15 @@ import path from 'path';
const config: StorybookConfig = { const config: StorybookConfig = {
stories: [ stories: [
'../components/**/*.stories.@(ts|tsx|js|jsx|mdx)', '../components/**/*.stories.@(ts|tsx|js|jsx|mdx)',
'../theme/**/*.stories.@(ts|tsx|js|jsx|mdx)' '../styles/**/*.stories.@(ts|tsx|js|jsx|mdx)'
], ],
addons: [ addons: [
'@storybook/addon-links', '@storybook/addon-links',
'@storybook/addon-essentials', '@storybook/addon-essentials',
'@storybook/addon-onboarding', '@storybook/addon-onboarding',
'@storybook/addon-interactions', '@storybook/addon-interactions',
'storybook-dark-mode' 'storybook-dark-mode',
'@storybook/addon-themes'
], ],
webpackFinal: async (config) => { webpackFinal: async (config) => {
if (config.resolve) { if (config.resolve) {
......
import React from 'react'; import React from 'react';
import { themes } from '@storybook/theming'; import { withThemeByClassName } from '@storybook/addon-themes';
import { HeroUIProvider } from "@heroui/react"; import { HeroUIProvider } from '@heroui/react';
import type { Preview, ReactRenderer } from '@storybook/react';
import './style.css'; import '@/styles/global.css';
import '@/styles/globals.css';
import type { Preview } from '@storybook/react';
const decorators: Preview['decorators'] = [ const decorators: Preview['decorators'] = [
(Story, { globals: { locale, disableAnimation } }) => { (Story, { globals: { locale, disableAnimation } }) => {
...@@ -22,7 +20,14 @@ const decorators: Preview['decorators'] = [ ...@@ -22,7 +20,14 @@ const decorators: Preview['decorators'] = [
</div> </div>
</HeroUIProvider> </HeroUIProvider>
); );
} },
withThemeByClassName<ReactRenderer>({
themes: {
light: '',
dark: 'dark'
},
defaultTheme: 'light'
})
]; ];
const parameters: Preview['parameters'] = { const parameters: Preview['parameters'] = {
...@@ -38,24 +43,6 @@ const parameters: Preview['parameters'] = { ...@@ -38,24 +43,6 @@ const parameters: Preview['parameters'] = {
color: /(background|color)$/i, color: /(background|color)$/i,
date: /Date$/i date: /Date$/i
} }
},
darkMode: {
current: 'dark',
stylePreview: true,
darkClass: 'dark',
lightClass: 'light',
classTarget: 'html',
dark: {
...themes.dark,
appBg: '#161616',
barBg: 'black',
background: 'black',
appContentBg: 'black',
appBorderRadius: 14
},
light: {
...themes.light
}
} }
}; };
......
@tailwind base;
@tailwind components;
@tailwind utilities;
h1 {
@apply text-4xl font-bold !text-foreground;
}
h2 {
@apply text-2xl font-bold !text-foreground !border-none;
}
h3 {
@apply text-xl font-bold !text-neutral-600;
}
.dark .sbdocs-wrapper,
.dark .sbdocs-preview {
background-color: #000000;
color: #fff;
}
.dark .sbdocs-preview {
border: 1px solid #292929;
}
.dark .docblock-code-toggle {
background: transparent;
color: #d4d4d4;
}
.dark div:has(.docblock-code-toggle) {
background: transparent;
}
.dark .os-theme-dark {
background: #161616;
color: #fff;
}
.dark .sbdocs-title {
color: #fff;
}
.dark .docblock-argstable-head {
background: #161616;
}
.dark .docblock-argstable-head th {
color: #bcbcbc;
border-bottom: 1px solid #292929 !important;
}
.dark .docblock-argstable-head th span {
color: #bcbcbc;
}
.dark #docs-root tbody td {
background: #161616 !important;
color: #bcbcbc !important;
}
.dark #docs-root tbody tr:first-child td:first-child {
border-top-left-radius: 0 !important;
}
.dark #docs-root tbody tr:first-child td:last-child {
border-top-right-radius: 0 !important;
}
.dark #docs-root tbody tr:not(:first-child) {
border-top: 1px solid #292929 !important;
}
import Providers from '@/components/layout/Providers'; import Providers from '@/components/layout/Providers';
import '@/styles/globals.css'; import '@/styles/global.css';
interface LayoutProps { interface LayoutProps {
children: React.ReactNode; children: React.ReactNode;
......
@use '@styles/vars.scss';
.notFound {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10vh 1em;
box-sizing: border-box;
h2 {
font-size: 10em;
font-weight: 100;
line-height: 0.8;
margin: 0;
color: #1ea7fd;
}
a {
margin-top: 2em;
}
}
@include vars.mQuery(xl) {
.notFound {
font-size: 0.9em;
}
}
...@@ -58,7 +58,7 @@ export const ResponsiveImage: React.FC<ResponsiveImageProps> & { ...@@ -58,7 +58,7 @@ export const ResponsiveImage: React.FC<ResponsiveImageProps> & {
return ( return (
<picture> <picture>
{children} {children}
<img alt="" {...props} {...rest} /> <img {...props} {...rest} />
</picture> </picture>
); );
} }
......
...@@ -11,12 +11,7 @@ const COMMON_UNITS = ['small', 'medium', 'large']; ...@@ -11,12 +11,7 @@ const COMMON_UNITS = ['small', 'medium', 'large'];
*/ */
const twMerge = extendTailwindMerge({ const twMerge = extendTailwindMerge({
extend: { extend: {
theme: { theme: {},
opacity: ['disabled'],
spacing: ['divider'],
borderWidth: COMMON_UNITS,
borderRadius: COMMON_UNITS
},
classGroups: { classGroups: {
shadow: [{ shadow: COMMON_UNITS }], shadow: [{ shadow: COMMON_UNITS }],
'font-size': [{ text: ['tiny', ...COMMON_UNITS] }], 'font-size': [{ text: ['tiny', ...COMMON_UNITS] }],
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
"analyze": "cross-env ANALYZE=true next build" "analyze": "cross-env ANALYZE=true next build"
}, },
"dependencies": { "dependencies": {
"@heroui/react": "2.7.6", "@heroui/react": "2.8.0-beta.4",
"@tailwindcss/postcss": "^4.1.6",
"@types/node": "^22.15.17", "@types/node": "^22.15.17",
"@types/react": "^19.1.3", "@types/react": "^19.1.3",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
...@@ -24,8 +25,8 @@ ...@@ -24,8 +25,8 @@
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0", "react-dom": "^19.1.0",
"sharp": "^0.34.1", "sharp": "^0.34.1",
"tailwind-merge": "^2.6.0", "tailwind-merge": "^3.3.0",
"tailwindcss": "^3.4.1", "tailwindcss": "^4.1.6",
"typescript": "^5.8.3" "typescript": "^5.8.3"
}, },
"devDependencies": { "devDependencies": {
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
"@storybook/addon-interactions": "8.6.12", "@storybook/addon-interactions": "8.6.12",
"@storybook/addon-links": "^8.6.12", "@storybook/addon-links": "^8.6.12",
"@storybook/addon-onboarding": "8.6.12", "@storybook/addon-onboarding": "8.6.12",
"@storybook/addon-themes": "^8.6.12",
"@storybook/blocks": "8.6.12", "@storybook/blocks": "8.6.12",
"@storybook/nextjs": "^8.6.12", "@storybook/nextjs": "^8.6.12",
"@storybook/react": "8.6.12", "@storybook/react": "8.6.12",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
module.exports = { export default {
plugins: { plugins: {
tailwindcss: {}, '@tailwindcss/postcss': {}
autoprefixer: {}
} }
}; };
@import 'tailwindcss';
@plugin './hero.ts';
@source '../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}';
@custom-variant dark (&:is(.dark *));
@tailwind base;
@tailwind components;
@tailwind utilities;
import { heroui } from '@heroui/react';
import themes from './themes';
export default heroui({ themes });
import { heroui } from '@heroui/react';
import colors from './theme/colors';
import type { Config } from 'tailwindcss';
const config: Config = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./theme/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}'
],
theme: {
extend: {
fontFamily: {
sans: ['Indivisible', 'sans-serif']
}
}
},
darkMode: 'class',
plugins: [
heroui({
themes: {
light: colors.light,
dark: colors.dark
}
})
]
};
export default config;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment