-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Feat : Made a tailwind config customisable by api
- Updated global CSS and theme variables to set primary and secondary colorsfor light and dark modes. - Modified tailwind configuration in UI and app components, ensuring consistency of colors and styles. - Made the root layout to be able to load the variables from an api call
- Loading branch information
1 parent
24fb777
commit 24948c5
Showing
10 changed files
with
93 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
export * from "@repo/tailwind-config/tw-config"; | ||
import {type Config} from "tailwindcss"; | ||
import { presetTheme } from "@repo/tailwind-config/tw-config"; | ||
|
||
const config = { | ||
content: [ | ||
"./app/**/*.{js,ts,jsx,tsx,mdx}", | ||
"./pages/**/*.{js,ts,jsx,tsx,mdx}", | ||
"./components/**/*.{js,ts,jsx,tsx,mdx}", | ||
|
||
// Or if using `src` directory: | ||
"./src/**/*.{js,ts,jsx,tsx,mdx}", | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
presets: [presetTheme], | ||
} satisfies Config | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
export * from "@repo/tailwind-config/tw-config"; | ||
import {type Config} from "tailwindcss"; | ||
import { presetTheme } from "@repo/tailwind-config/tw-config"; | ||
|
||
const config = { | ||
content: [ | ||
"./app/**/*.{js,ts,jsx,tsx,mdx}", | ||
"./pages/**/*.{js,ts,jsx,tsx,mdx}", | ||
"./components/**/*.{js,ts,jsx,tsx,mdx}", | ||
|
||
// Or if using `src` directory: | ||
"./src/**/*.{js,ts,jsx,tsx,mdx}", | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
presets: [presetTheme], | ||
} satisfies Config | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
|
||
@layer base { | ||
:root{ | ||
--primary: #006FEE; | ||
--primary-foreground: #FFFFFF; | ||
|
||
--success: #17c964; | ||
--success-foreground: #11181C; | ||
|
||
--warning: #f5a524; | ||
--warning-foreground: #11181C; | ||
|
||
--danger: #f31260; | ||
--danger-foreground: #FFFFFF; | ||
|
||
--focus: #006FEE; | ||
} | ||
|
||
.default.light { | ||
--background: #FFFFFF; | ||
--foreground: #11181C; | ||
|
||
--secondary: #d4d4d8; | ||
--secondary-foreground: #11181C; | ||
|
||
--content-1: #FFFFFF; | ||
--content-2: #f4f4f5; | ||
--content-3: #e4e4e7; | ||
--content-4: #d4d4d8; | ||
} | ||
|
||
.default.dark { | ||
--background: #000000; | ||
--foreground: #ECEDEE; | ||
|
||
--secondary: #3f3f46; | ||
--secondary-foreground: #FFFFFF; | ||
|
||
--content-1: #18181b; | ||
--content-2: #27272a; | ||
--content-3: #3f3f46; | ||
--content-4: #52525b; | ||
} | ||
} | ||
|
||
@layer base { | ||
html, | ||
body { | ||
scroll-behavior: smooth; | ||
--header-height: 74px; | ||
--footer-height: 60px; | ||
--sidebar-width: 260px; | ||
} | ||
/* Track */ | ||
::-webkit-scrollbar { | ||
width: 8px; | ||
} | ||
::-webkit-scrollbar-track { | ||
background: #f2f2f2; | ||
} | ||
/* Handle */ | ||
::-webkit-scrollbar-thumb { | ||
border-radius: 8px; | ||
background: #999; | ||
} | ||
/* Handle on hover */ | ||
::-webkit-scrollbar-thumb:hover { | ||
background: #777; | ||
} | ||
} | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
export function ApplicationLayout({ children }: { children: React.ReactNode }) { | ||
return <body className="h-screen w-full light">{children}</body>; | ||
"use client"; | ||
|
||
import { ReactNode, useEffect } from "react"; | ||
import { themeVariablesCSS } from "./theme-variables"; | ||
|
||
export function ApplicationLayout({ children }: { children: ReactNode }) { | ||
|
||
useEffect(() => { | ||
themeVariablesCSS() | ||
}, []); | ||
|
||
return <body className="h-screen w-full light bg-primary">{children}</body>; | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/ui/src/components/application-layout/theme-variables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function setDocumentStyleProperty(property: string, value: string) { | ||
document.documentElement.style.setProperty(property, value); | ||
} | ||
|
||
export function themeVariablesCSS() { | ||
setDocumentStyleProperty("--primary", "255, 137, 36"); | ||
setDocumentStyleProperty("--primary-dark", "255, 137, 36"); | ||
setDocumentStyleProperty("--primary-foreground", "255, 255, 255"); | ||
setDocumentStyleProperty("--primary-foreground-dark", "255, 255, 255"); | ||
setDocumentStyleProperty("--secondary", "212, 212, 216"); | ||
setDocumentStyleProperty("--secondary-dark", "63, 63, 70"); | ||
setDocumentStyleProperty("--secondary-foreground", "17, 24, 28") | ||
setDocumentStyleProperty("--secondary-foreground-dark", "255, 255, 255") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
export * from "@repo/tailwind-config/tw-config"; | ||
import {type Config} from "tailwindcss"; | ||
import { presetTheme } from "@repo/tailwind-config/tw-config"; | ||
|
||
/** | ||
* Author: sidarth-23 | ||
* Date: 2023-02-15 | ||
* | ||
* Any changes you want, make it in the tailwind config package so that it is consistent across all the apps | ||
*/ | ||
const config = { | ||
content: [ | ||
"./components/**/*.{js,ts,jsx,tsx,mdx}", | ||
|
||
// Or if using `src` directory: | ||
"./src/**/*.{js,ts,jsx,tsx,mdx}", | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
presets: [presetTheme], | ||
} satisfies Config | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters