-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kevin Lint
committed
Jun 27, 2024
1 parent
17ce72c
commit c9c3a9d
Showing
20 changed files
with
710 additions
and
255 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { theme, themes } from "../../state"; | ||
|
||
export type SliderSettings = { | ||
bgColorHoverToken: `--${string}`; | ||
bgColorToken: `--${string}`; | ||
borderColorToken: `--${string}`; | ||
borderColorHoverToken: `--${string}`; | ||
borderRadius: `--${string}`; | ||
borderWidth: `--${string}`; | ||
colorHoverToken: `--${string}`; | ||
colorToken: `--${string}`; | ||
}; | ||
|
||
export const DEFAULT_SLIDER_SETTINGS: SliderSettings = { | ||
bgColorHoverToken: "--background-100", | ||
bgColorToken: "--background-100", | ||
borderColorToken: "--foreground-100", | ||
borderColorHoverToken: "--foreground-200", | ||
borderRadius: "--border-radius-500", | ||
borderWidth: "--border-width-100", | ||
colorHoverToken: "--foreground-500", | ||
colorToken: "--foreground-500", | ||
}; | ||
|
||
export const sliderStyleSheet = new CSSStyleSheet(); | ||
|
||
export const renderSliderStyleSheet = () => { | ||
const settings = theme.get() !== "none" ? themes.get()[theme.get()].slider : DEFAULT_SLIDER_SETTINGS; | ||
|
||
return sliderStyleSheet.replaceSync(` | ||
.slider { | ||
--slider-bg-color: var(${settings.bgColorToken}, black); | ||
--slider-bg-color-hover: var(${settings.bgColorHoverToken}, rgba(0, 0, 0, 0.1)); | ||
--slider-border-color: var(${settings.borderColorToken}, black); | ||
--slider-border-radius: ${settings.borderRadius}ch; | ||
--slider-border-width: ${settings.borderWidth}ch; | ||
--slider-color: var(${settings.colorToken}, white); | ||
--slider-color-hover: var(${settings.colorHoverToken}, black); | ||
} | ||
.slider { | ||
-webkit-appearance: none; | ||
appearance: none; | ||
background: var(--slider-bg-color); | ||
border-radius: var(--slider-border-radius); | ||
height: 20px; | ||
width: 100%; | ||
} | ||
.slider:hover { | ||
background: var(--slider-bg-color-hover); | ||
} | ||
.slider::-webkit-slider-thumb { | ||
appearance: none; | ||
width: 20px; | ||
height: 20px; | ||
border-radius: 50%; | ||
background: var(--slider-color); | ||
cursor: pointer; | ||
} | ||
.slider::-webkit-slider-thumb:hover { | ||
background: var(--slider-color-hover); | ||
} | ||
`); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { theme, themes } from "../../state"; | ||
|
||
export type TypographySettings = { | ||
colorToken: `--${string}`; | ||
fontSizeBase: number; | ||
fontSizeSpread: number; | ||
fontWeight: number; | ||
lineHeight: number; | ||
}; | ||
|
||
export const DEFAULT_TYPOGRAPHY_SETTINGS: TypographySettings = { | ||
colorToken: "--text-500", | ||
fontSizeBase: 1.5, | ||
fontSizeSpread: 0.25, | ||
fontWeight: 500, | ||
lineHeight: 1.5, | ||
}; | ||
|
||
export const typographyStylesheet = new CSSStyleSheet(); | ||
|
||
export const renderTypographyStylesheet = () => { | ||
const settings = theme.get() !== "none" ? themes.get()[theme.get()].typography : DEFAULT_TYPOGRAPHY_SETTINGS; | ||
const typographyTagList = ".h1, .h2, .h3, .h4, .h5, .h6, .p, .span, .div, .li, .td, .th, .summary"; | ||
const styles = ` | ||
${typographyTagList} { | ||
--text-color: var(${settings.colorToken}, white); | ||
--text-font-size-base: ${settings.fontSizeBase}ch; | ||
--text-font-weight: ${settings.fontWeight}; | ||
--text-line-height: ${settings.lineHeight}ch; | ||
} | ||
.h1 { font-size: calc(var(--text-font-size-base) * 2); } | ||
.h2 { font-size: calc(var(--text-font-size-base) * 1.5); } | ||
.h3 { font-size: calc(var(--text-font-size-base) * 1.25); } | ||
.h4 { font-size: var(--text-font-size-base); } | ||
.h5 { font-size: calc(var(--text-font-size-base) * 0.75); } | ||
.h6 { font-size: calc(var(--text-font-size-base) * 0.5); } | ||
.p { font-size: var(--text-font-size-base); } | ||
.span { font-size: var(--text-font-size-base); } | ||
.div { font-size: var(--text-font-size-base); } | ||
.li { font-size: var(--text-font-size-base); } | ||
.td { font-size: var(--text-font-size-base); } | ||
.th { font-size: var(--text-font-size-base); } | ||
.summary { font-size: var(--text-font-size-base); } | ||
`; | ||
|
||
return typographyStylesheet.replaceSync(styles); | ||
}; |
Oops, something went wrong.