Skip to content

Commit

Permalink
Merge pull request #42 from SySagar/dev
Browse files Browse the repository at this point in the history
style: added font tokens
  • Loading branch information
SySagar authored Jul 26, 2024
2 parents b2bdd2e + ee50a16 commit bc1bcc4
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 107 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-ads-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@groovy-box/ui': minor
---

font tokens added
1 change: 1 addition & 0 deletions apps/ui/lib/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@groovy-box/tokens/src/fonts.css';
import './tailwind.css';

export * from './components/Button';
Expand Down
10 changes: 8 additions & 2 deletions apps/ui/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import plugin from 'tailwindcss/plugin';
import type { Config } from 'tailwindcss';
import { colors, customTypographyClasses } from '@groovy-box/tokens';
import {
colors,
customTypographyClasses,
groovyFontFamily,
} from '@groovy-box/tokens';

/** @type {import('tailwindcss').Config} */
module.exports = {
Expand All @@ -9,7 +13,9 @@ module.exports = {
'./stories/**/*.{ts,tsx,js,jsx}',
],
theme: {
extend: {},
extend: {
fontFamily: groovyFontFamily,
},
colors,
},
plugins: [
Expand Down
14 changes: 9 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions packages/tokens/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "@groovy-box/tokens",
"version": "1.0.1",
"version": "1.0.0",
"private": true,
"description": "Design tokens for groovy box",
"main": "src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
"license": "ISC",
"devDependencies": {
"tailwindcss": "^3.4.7"
}
}
Empty file removed packages/tokens/src/font/base.ts
Empty file.
1 change: 1 addition & 0 deletions packages/tokens/src/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap');
Binary file not shown.
137 changes: 39 additions & 98 deletions packages/tokens/src/typography/base.ts
Original file line number Diff line number Diff line change
@@ -1,100 +1,41 @@
const createTypographyClass = (
className,
fontSize,
lineHeight,
fontWeight,
letterSpacing = 'normal',
) => ({
[className]: {
fontSize,
lineHeight,
fontWeight,
fontFamily: 'Inter, sans-serif',
letterSpacing,
},
});

export const groovyFontFamily = {
Inter: ['Inter', 'sans-serif'],
};

export const customTypographyClasses = {
'.typo-body-1': {
fontSize: '16px',
lineHeight: '24px',
fontWeight: '400',
},
'.typo-body-2': {
fontSize: '14px',
lineHeight: '20px',
fontWeight: '400',
},
'.typo-body-3': {
fontSize: '12px',
lineHeight: '16px',
fontWeight: '400',
},
'.typo-button-1': {
fontSize: '16px',
lineHeight: '26px',
fontWeight: '500',
letterSpacing: '0.1px',
},
'.typo-button-2': {
fontSize: '14px',
lineHeight: '20px',
fontWeight: '500',
},
'.typo-button-3': {
fontSize: '12px',
lineHeight: '16px',
fontWeight: '500',
},
'.typo-heading-1': {
fontSize: '28px',
lineHeight: '36px',
fontWeight: '400',
},
'.typo-heading-2': {
fontSize: '24px',
lineHeight: '30px',
fontWeight: '600',
},
'.typo-heading-3': {
fontSize: '20px',
lineHeight: '26px',
fontWeight: '600',
},
'.typo-heading-4': {
fontSize: '18px',
lineHeight: '24px',
fontWeight: '600',
},
'.typo-heading-5': {
fontSize: '16px',
lineHeight: '22px',
fontWeight: '600',
},
'.typo-heading-6': {
fontSize: '14px',
lineHeight: '20px',
fontWeight: '600',
},
'.typo-label-1': {
fontSize: '14px',
lineHeight: '20px',
fontWeight: '400',
letterSpacing: '-0.24px',
},
'.typo-label-2': {
fontSize: '12px',
lineHeight: '16px',
fontWeight: '400',
},
'.typo-label-2-strong': {
fontSize: '12px',
lineHeight: '16px',
fontWeight: '500',
},
'.typo-label-3': {
fontSize: '10px',
lineHeight: '12px',
fontWeight: '400',
},
'.typo-subtitle-1': {
fontSize: '16px',
lineHeight: '22px',
fontWeight: '500',
letterSpacing: '0.1px',
},
'.typo-subtitle-2': {
fontSize: '14px',
lineHeight: '20px',
fontWeight: '500',
},
'.typo-subtitle-3': {
fontSize: '12px',
lineHeight: '16px',
fontWeight: '500',
},
...createTypographyClass('.typo-body-1', '16px', '24px', '400'),
...createTypographyClass('.typo-body-2', '14px', '20px', '400'),
...createTypographyClass('.typo-body-3', '12px', '16px', '400'),
...createTypographyClass('.typo-button-1', '16px', '26px', '500', '0.1px'),
...createTypographyClass('.typo-button-2', '14px', '20px', '500'),
...createTypographyClass('.typo-button-3', '12px', '16px', '500'),
...createTypographyClass('.typo-heading-1', '28px', '36px', '400'),
...createTypographyClass('.typo-heading-2', '24px', '30px', '600'),
...createTypographyClass('.typo-heading-3', '20px', '26px', '600'),
...createTypographyClass('.typo-heading-4', '18px', '24px', '600'),
...createTypographyClass('.typo-heading-5', '16px', '22px', '600'),
...createTypographyClass('.typo-heading-6', '14px', '20px', '600'),
...createTypographyClass('.typo-label-1', '14px', '20px', '400', '-0.24px'),
...createTypographyClass('.typo-label-2', '12px', '16px', '400'),
...createTypographyClass('.typo-label-2-strong', '12px', '16px', '500'),
...createTypographyClass('.typo-label-3', '10px', '12px', '400'),
...createTypographyClass('.typo-subtitle-1', '16px', '22px', '500', '0.1px'),
...createTypographyClass('.typo-subtitle-2', '14px', '20px', '500'),
...createTypographyClass('.typo-subtitle-3', '12px', '16px', '500'),
};

0 comments on commit bc1bcc4

Please sign in to comment.