From 28fb233907f5659f15bf8441827e91fc73160de7 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Tue, 28 Oct 2025 18:55:48 +0000 Subject: [PATCH] feat: define typography tokens --- src/index.css | 5 ++++- src/styles/tokens.css | 46 +++++++++++++++++++++++++++++++++++++++++++ tailwind.config.js | 24 +++++++++++++++++++++- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/index.css b/src/index.css index bff89849..89d59173 100644 --- a/src/index.css +++ b/src/index.css @@ -12,7 +12,10 @@ body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + font-family: var(--font-family-sans); + font-size: var(--font-size-base); + line-height: var(--line-height-normal); + font-weight: var(--font-weight-regular); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; background-color: var(--surface-base); diff --git a/src/styles/tokens.css b/src/styles/tokens.css index 44f798c6..a96546b9 100644 --- a/src/styles/tokens.css +++ b/src/styles/tokens.css @@ -33,6 +33,29 @@ --message-assistant-border: #9c27b0; --message-tool-bg: #f8f9fa; --message-tool-border: #6c757d; + + /* Typography tokens */ + --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; + + /* Font weights */ + --font-weight-regular: 400; + --font-weight-medium: 500; + --font-weight-semibold: 600; + --font-weight-bold: 700; + + /* Font sizes */ + --font-size-xs: 11px; + --font-size-sm: 12px; + --font-size-base: 14px; + --font-size-lg: 16px; + --font-size-xl: 18px; + --font-size-2xl: 20px; + + /* Line heights */ + --line-height-tight: 1.25; + --line-height-normal: 1.5; + --line-height-relaxed: 1.6; } [data-theme="dark"] { @@ -70,4 +93,27 @@ --message-assistant-border: #ba68c8; --message-tool-bg: #212529; --message-tool-border: #adb5bd; + + /* Typography tokens (same as light theme) */ + --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; + + /* Font weights */ + --font-weight-regular: 400; + --font-weight-medium: 500; + --font-weight-semibold: 600; + --font-weight-bold: 700; + + /* Font sizes */ + --font-size-xs: 11px; + --font-size-sm: 12px; + --font-size-base: 14px; + --font-size-lg: 16px; + --font-size-xl: 18px; + --font-size-2xl: 20px; + + /* Line heights */ + --line-height-tight: 1.25; + --line-height-normal: 1.5; + --line-height-relaxed: 1.6; } \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js index 99b1f3b0..6f453bc0 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -5,7 +5,29 @@ export default { extend: { colors: {}, spacing: {}, - fontSize: {}, + fontSize: { + 'xs': ['var(--font-size-xs)', { lineHeight: 'var(--line-height-normal)' }], + 'sm': ['var(--font-size-sm)', { lineHeight: 'var(--line-height-normal)' }], + 'base': ['var(--font-size-base)', { lineHeight: 'var(--line-height-normal)' }], + 'lg': ['var(--font-size-lg)', { lineHeight: 'var(--line-height-tight)' }], + 'xl': ['var(--font-size-xl)', { lineHeight: 'var(--line-height-tight)' }], + '2xl': ['var(--font-size-2xl)', { lineHeight: 'var(--line-height-tight)' }], + 'body': ['var(--font-size-base)', { lineHeight: 'var(--line-height-normal)' }], + 'label': ['var(--font-size-sm)', { lineHeight: 'var(--line-height-normal)' }], + 'heading': ['var(--font-size-lg)', { lineHeight: 'var(--line-height-tight)' }], + }, + fontFamily: { + 'sans': ['var(--font-family-sans)', 'system-ui', 'sans-serif'], + 'mono': ['var(--font-family-mono)', 'monospace'], + 'body': ['var(--font-family-sans)', 'system-ui', 'sans-serif'], + 'heading': ['var(--font-family-sans)', 'system-ui', 'sans-serif'], + }, + fontWeight: { + 'regular': 'var(--font-weight-regular)', + 'medium': 'var(--font-weight-medium)', + 'semibold': 'var(--font-weight-semibold)', + 'bold': 'var(--font-weight-bold)', + }, borderRadius: {}, boxShadow: {}, },