diff --git a/packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioFilePreview/index.tsx b/packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioFilePreview/index.tsx index 126f556..987e2b2 100644 --- a/packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioFilePreview/index.tsx +++ b/packages/web-kitchensink-reactnext/src/categories/blob/react/components/AudioFilePreview/index.tsx @@ -6,11 +6,13 @@ import { formatSecondsDurationConcise, formatSecondsDurationPrecise, } from '@/utils/numeral'; +import theme from '@/styles/theme'; import {useMediaControls} from '../../hooks/interactive'; import {useAugmentedFile} from '@/categories/blob/react'; import clsx from 'clsx'; import {WaveSurferCanvas} from '@/packages/react-wavesurfer'; +import {Slider} from '@/categories/number/react'; type AudioFilePreviewDerivedComponent = HTMLAudioElement; @@ -99,53 +101,59 @@ export const AudioFilePreview = React.forwardRef {visualizationMode === 'waveform' && ( Math.floor(Number(c) / 2)).join(' ')})`} + progressColor={`rgb(${theme.primary})`} interact /> )}
{enhanced && ( -
+
- - - - +
+ {formatSecondsDurationConcise(durationDisplay)}
-
- + +
{enhanced && ( -
+
- - +
+ + {formatSecondsDurationConcise(durationDisplay)} - - {formatSecondsDurationConcise(durationDisplay)} -
- , 'type'> { + +} + +export const Slider = React.forwardRef(({ + className, + style, + ...etcProps +}, forwardedRef) => { + return ( +
+ +
+ ) +}); + +Slider.displayName = 'Slider'; diff --git a/packages/web-kitchensink-reactnext/src/categories/number/react/index.ts b/packages/web-kitchensink-reactnext/src/categories/number/react/index.ts new file mode 100644 index 0000000..629b8f6 --- /dev/null +++ b/packages/web-kitchensink-reactnext/src/categories/number/react/index.ts @@ -0,0 +1 @@ +export * from './components/Slider'; diff --git a/packages/web-kitchensink-reactnext/src/pages/_document.tsx b/packages/web-kitchensink-reactnext/src/pages/_document.tsx index d591014..d4a4cb5 100644 --- a/packages/web-kitchensink-reactnext/src/pages/_document.tsx +++ b/packages/web-kitchensink-reactnext/src/pages/_document.tsx @@ -1,9 +1,14 @@ import { Html, Head, Main, NextScript } from 'next/document' +import theme from '@/styles/theme' export default function Document() { return ( - + + +
diff --git a/packages/web-kitchensink-reactnext/src/styles/globals.css b/packages/web-kitchensink-reactnext/src/styles/globals.css index ea86b59..31d612f 100644 --- a/packages/web-kitchensink-reactnext/src/styles/globals.css +++ b/packages/web-kitchensink-reactnext/src/styles/globals.css @@ -1,41 +1,72 @@ @tailwind base; @tailwind utilities; -@layer base { - :root { - --color-shade: 0 0 0; - --color-negative: 34 34 34; - --color-positive: 238 238 238; - --color-primary: 199 138 179; - --color-secondary: 255 153 0; - --color-tertiary: 215 95 75; - --color-code-number: 116 249 94; - --color-code-keyword: 255 67 137; - --color-code-type: 80 151 210; - --color-code-instance-attribute: 118 167 210; - --color-code-function: 103 194 82; - --color-code-parameter: 145 94 194; - --color-code-property: 255 161 201; - --color-code-string: 238 211 113; - --color-code-variable: 139 194 117; - --color-code-regexp: 116 167 43; - --color-code-url: 0 153 204; - --color-code-global: 194 128 80; +@layer utilities { + .font-condensed { + font-stretch: condensed; } + + .font-semi-condensed { + font-stretch: semi-condensed; + } + + .font-expanded { + font-stretch: expanded; + } + + .font-semi-expanded { + font-stretch: semi-expanded; + } +} + +.slider { + @apply rounded-full; + appearance: none; + cursor: pointer; + position: relative; + overflow: hidden; + height: 1em; + color: rgb(var(--color-primary)); +} + +.slider::before { + @apply rounded-full; + content: ''; + display: block; + position: absolute; + background-color: currentColor; + opacity: 0.5; + width: 100%; + height: 50%; + top: 25%; +} + +.slider::-webkit-slider-container { + height: 100%; + overflow: hidden; + box-sizing: border-box; } -.font-condensed { - font-stretch: condensed; +.slider::-webkit-slider-runnable-track { + appearance: none; + height: 100%; } -.font-semi-condensed { - font-stretch: semi-condensed; +.slider::-webkit-slider-thumb { + @apply rounded-full; + background-color: currentColor; + appearance: none; + height: 100%; + aspect-ratio: 1 / 1; + z-index: 1; + position: relative; + box-shadow: -100000.5em 0 0 100000em rgb(var(--color-primary) / 50%); } -.font-expanded { - font-stretch: expanded; +.slider:focus::-webkit-slider-thumb { + box-shadow: -100000.5em 0 0 100000em rgb(var(--color-secondary) / 50%); } -.font-semi-expanded { - font-stretch: semi-expanded; +.slider:active::-webkit-slider-thumb { + box-shadow: -100000.5em 0 0 100000em rgb(var(--color-tertiary) / 50%); } diff --git a/packages/web-kitchensink-reactnext/src/styles/theme.ts b/packages/web-kitchensink-reactnext/src/styles/theme.ts new file mode 100644 index 0000000..243f6b9 --- /dev/null +++ b/packages/web-kitchensink-reactnext/src/styles/theme.ts @@ -0,0 +1,22 @@ +const theme = { + "shade": "0 0 0", + "negative": "34 34 34", + "positive": "238 238 238", + "primary": "199 138 179", + "secondary": "255 153 0", + "tertiary": "215 95 75", + "code-number": "116 249 94", + "code-keyword": "255 67 137", + "code-type": "80 151 210", + "code-instance-attribute": "118 167 210", + "code-function": "103 194 82", + "code-parameter": "145 94 194", + "code-property": "255 161 201", + "code-string": "238 211 113", + "code-variable": "139 194 117", + "code-regexp": "116 167 43", + "code-url": "0 153 204", + "code-global": "194 128 80" +} as const; + +export default theme; diff --git a/packages/web-kitchensink-reactnext/tailwind.config.js b/packages/web-kitchensink-reactnext/tailwind.config.js index 36cb3cd..0fa61ff 100644 --- a/packages/web-kitchensink-reactnext/tailwind.config.js +++ b/packages/web-kitchensink-reactnext/tailwind.config.js @@ -1,3 +1,5 @@ +const defaultTheme = require('tailwindcss/defaultTheme') + /** @type {import('tailwindcss').Config} */ module.exports = { content: [ @@ -7,7 +9,8 @@ module.exports = { ], theme: { fontFamily: { - sans: ['Encode Sans Semi Expanded', 'Encode Sans', 'sans-serif'], + sans: ['Encode Sans', ...defaultTheme.fontFamily.sans], + mono: ['MonoLisa', 'mononoki', ...defaultTheme.fontFamily.mono], }, colors: { 'shade': 'rgb(var(--color-shade))', diff --git a/packages/web-kitchensink-reactnext/tsconfig.json b/packages/web-kitchensink-reactnext/tsconfig.json index 7a58ff1..0824439 100644 --- a/packages/web-kitchensink-reactnext/tsconfig.json +++ b/packages/web-kitchensink-reactnext/tsconfig.json @@ -16,6 +16,7 @@ "incremental": true, "paths": { "@/*": ["./src/*"], + "tailwind.config": ["./tailwind.config.js"], "@tesseract-design/web-base-button": ["./src/base/button"], "@tesseract-design/web-base-selectcontrol": ["./src/base/selectcontrol"], "@tesseract-design/web-base-textcontrol": ["./src/base/textcontrol"], @@ -24,6 +25,7 @@ "@tesseract-design/web-freeform-react": ["./src/categories/freeform/react"], "@tesseract-design/web-information-react": ["./src/categories/information/react"], "@tesseract-design/web-option-react": ["./src/categories/option/react"], + "@tesseract-design/web-number-react": ["./src/categories/number/react"], "@tesseract-design/web-navigation-react": ["./src/categories/navigation/react"], } },