-
-
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.
fix: 🐛 tremor chart library styling was not working with shadcn
- Loading branch information
1 parent
da36a5a
commit 2b21f28
Showing
11 changed files
with
197 additions
and
54 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
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,7 @@ | ||
module.exports = require("@convoform/ui/postcss.config"); | ||
// eslint-disable-next-line no-undef | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
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
File renamed without changes.
166 changes: 166 additions & 0 deletions
166
apps/web/src/lib/config/tailwind.config/tremor.chart.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,166 @@ | ||
import headlessui_tailwindcss from "@headlessui/tailwindcss"; | ||
import tailwindcss_forms from "@tailwindcss/forms"; | ||
import type { Config } from "tailwindcss"; | ||
import colors from "tailwindcss/colors"; | ||
|
||
const config = { | ||
content: [ | ||
"./src/**/*.{js,ts,jsx,tsx}", | ||
"./node_modules/@tremor/**/*.{js,ts,jsx,tsx}", | ||
], | ||
theme: { | ||
transparent: "transparent", | ||
current: "currentColor", | ||
extend: { | ||
colors: { | ||
// light mode | ||
tremor: { | ||
brand: { | ||
faint: colors.blue[50], | ||
muted: colors.blue[200], | ||
subtle: colors.blue[400], | ||
DEFAULT: colors.blue[500], | ||
emphasis: colors.blue[700], | ||
inverted: colors.white, | ||
}, | ||
background: { | ||
muted: colors.gray[50], | ||
subtle: colors.gray[100], | ||
DEFAULT: colors.white, | ||
emphasis: colors.gray[700], | ||
}, | ||
border: { | ||
DEFAULT: colors.gray[200], | ||
}, | ||
ring: { | ||
DEFAULT: colors.gray[200], | ||
}, | ||
content: { | ||
subtle: colors.gray[400], | ||
DEFAULT: colors.gray[500], | ||
emphasis: colors.gray[700], | ||
strong: colors.gray[900], | ||
inverted: colors.white, | ||
}, | ||
}, | ||
// dark mode | ||
"dark-tremor": { | ||
brand: { | ||
faint: "#0B1229", | ||
muted: colors.blue[950], | ||
subtle: colors.blue[800], | ||
DEFAULT: colors.blue[500], | ||
emphasis: colors.blue[400], | ||
inverted: colors.blue[950], | ||
}, | ||
background: { | ||
muted: "#131A2B", | ||
subtle: colors.gray[800], | ||
DEFAULT: colors.gray[900], | ||
emphasis: colors.gray[300], | ||
}, | ||
border: { | ||
DEFAULT: colors.gray[800], | ||
}, | ||
ring: { | ||
DEFAULT: colors.gray[800], | ||
}, | ||
content: { | ||
subtle: colors.gray[600], | ||
DEFAULT: colors.gray[500], | ||
emphasis: colors.gray[200], | ||
strong: colors.gray[50], | ||
inverted: colors.gray[950], | ||
}, | ||
}, | ||
}, | ||
boxShadow: { | ||
// light | ||
"tremor-input": "0 1px 2px 0 rgb(0 0 0 / 0.05)", | ||
"tremor-card": | ||
"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)", | ||
"tremor-dropdown": | ||
"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)", | ||
// dark | ||
"dark-tremor-input": "0 1px 2px 0 rgb(0 0 0 / 0.05)", | ||
"dark-tremor-card": | ||
"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)", | ||
"dark-tremor-dropdown": | ||
"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)", | ||
}, | ||
borderRadius: { | ||
"tremor-small": "0.375rem", | ||
"tremor-default": "0.5rem", | ||
"tremor-full": "9999px", | ||
}, | ||
fontSize: { | ||
"tremor-label": ["0.75rem", { lineHeight: "1rem" }], | ||
"tremor-default": ["0.875rem", { lineHeight: "1.25rem" }], | ||
"tremor-title": ["1.125rem", { lineHeight: "1.75rem" }], | ||
"tremor-metric": ["1.875rem", { lineHeight: "2.25rem" }], | ||
}, | ||
}, | ||
}, | ||
safelist: [ | ||
{ | ||
pattern: | ||
/^(bg-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/, | ||
variants: ["hover", "ui-selected"], | ||
}, | ||
{ | ||
pattern: | ||
/^(text-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/, | ||
variants: ["hover", "ui-selected"], | ||
}, | ||
{ | ||
pattern: | ||
/^(border-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/, | ||
variants: ["hover", "ui-selected"], | ||
}, | ||
{ | ||
pattern: | ||
/^(ring-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/, | ||
}, | ||
{ | ||
pattern: | ||
/^(stroke-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/, | ||
}, | ||
{ | ||
pattern: | ||
/^(fill-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/, | ||
}, | ||
], | ||
plugins: [headlessui_tailwindcss, tailwindcss_forms], | ||
}; | ||
|
||
// add tremor config to your exist tailwind.config.ts | ||
export const withTremorConfig = (existConfig: Omit<Config, "content">) => { | ||
return { | ||
...existConfig, | ||
content: [...existConfig.content, ...config.content], | ||
theme: { | ||
...existConfig.theme, | ||
...config.theme, | ||
extend: { | ||
...existConfig.theme?.extend, | ||
...config.theme.extend, | ||
colors: { | ||
...existConfig.theme?.extend?.colors, | ||
...config.theme.extend.colors, | ||
}, | ||
boxShadow: { | ||
...existConfig.theme?.extend?.boxShadow, | ||
...config.theme.extend.boxShadow, | ||
}, | ||
fontSize: { | ||
...existConfig.theme?.extend?.fontSize, | ||
...config.theme.extend.fontSize, | ||
}, | ||
}, | ||
}, | ||
safelist: [...(existConfig.safelist ?? []), ...config.safelist], | ||
plugins: [...(existConfig.plugins ?? []), ...config.plugins], | ||
}; | ||
}; | ||
|
||
export default config; |
This file was deleted.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.