From 8a93a032cb9c27e024facc3df6e2be80d02dc510 Mon Sep 17 00:00:00 2001 From: Hossein Mehrabi Date: Mon, 5 Jun 2023 21:56:23 +0330 Subject: [PATCH] fix: fix typography settings of heading elements --- packages/logos-docusaurus-theme/package.json | 2 +- .../src/client/lib/themes.ts | 77 +++++++++++++++++++ .../src/client/theme/Root.tsx | 7 +- yarn.lock | 8 +- 4 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 packages/logos-docusaurus-theme/src/client/lib/themes.ts diff --git a/packages/logos-docusaurus-theme/package.json b/packages/logos-docusaurus-theme/package.json index 1748fc3..ac21357 100644 --- a/packages/logos-docusaurus-theme/package.json +++ b/packages/logos-docusaurus-theme/package.json @@ -20,7 +20,7 @@ "prepublishOnly": "yarn clean && yarn build" }, "dependencies": { - "@acid-info/lsd-react": "^0.1.0-alpha.8", + "@acid-info/lsd-react": "^0.1.0-alpha.13", "@docusaurus/core": "^2.4.1", "@docusaurus/mdx-loader": "^2.4.1", "@docusaurus/module-type-aliases": "^2.4.1", diff --git a/packages/logos-docusaurus-theme/src/client/lib/themes.ts b/packages/logos-docusaurus-theme/src/client/lib/themes.ts new file mode 100644 index 0000000..e584188 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/lib/themes.ts @@ -0,0 +1,77 @@ +import { + createTheme, + CreateThemeProps, + defaultThemes, +} from '@acid-info/lsd-react' + +const typography: CreateThemeProps['typography'] = { + h1: { + fontSize: '2.875rem', + lineHeight: '3.25rem', + }, + h2: { + fontSize: '2rem', + lineHeight: '2.5rem', + }, + h3: { + fontSize: '1.5rem', + lineHeight: '2rem', + }, + h4: { + fontSize: '1.375rem', + lineHeight: '1.75rem', + }, +} + +const typographyMobile: CreateThemeProps['typography'] = { + h1: { + fontSize: '2.25rem', + lineHeight: '2.75rem', + }, + h2: { + fontSize: '1.75rem', + lineHeight: '2.25rem', + }, +} + +const breakpoints: CreateThemeProps['breakpoints'] = { + xs: { + width: 0, + typography: typographyMobile, + }, + sm: { + width: 576, + }, + md: { + width: 768, + }, + lg: { + width: 997, + typography, + }, + xl: { + width: 1200, + }, +} + +export const lightTheme = createTheme( + { + breakpoints, + palette: {}, + typography, + typographyGlobal: {}, + name: 'logos-docusaurus-theme-light', + }, + defaultThemes.light, +) + +export const darkTheme = createTheme( + { + breakpoints: breakpoints, + palette: {}, + typography, + typographyGlobal: {}, + name: 'logos-docusaurus-theme-light', + }, + defaultThemes.dark, +) diff --git a/packages/logos-docusaurus-theme/src/client/theme/Root.tsx b/packages/logos-docusaurus-theme/src/client/theme/Root.tsx index 8108e4e..5133449 100644 --- a/packages/logos-docusaurus-theme/src/client/theme/Root.tsx +++ b/packages/logos-docusaurus-theme/src/client/theme/Root.tsx @@ -6,6 +6,7 @@ import { import React from 'react' import { useDocThemeOptions } from '../lib/useThemeOptions' import styles from './style.module.css' +import { lightTheme, darkTheme } from '../lib/themes' const Content = ({ children }) => { const colorMode = useColorMode() @@ -15,11 +16,7 @@ const Content = ({ children }) => { return (
{children} diff --git a/yarn.lock b/yarn.lock index 39d9b4f..0159a5b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@acid-info/lsd-react@^0.1.0-alpha.8": - version "0.1.0-alpha.11" - resolved "https://registry.yarnpkg.com/@acid-info/lsd-react/-/lsd-react-0.1.0-alpha.11.tgz#7c40f72d55f777fd3c308796c6ba6673a8eedaf6" - integrity sha512-ctB78tWN6dKIx6MIY9O7i7CVYjU/tWevxcBS26Q/cxCdIpirULwn0QbKwXJhEyuyQlbUJqW5ylrnpORrA3IG4A== +"@acid-info/lsd-react@^0.1.0-alpha.13": + version "0.1.0-alpha.13" + resolved "https://registry.yarnpkg.com/@acid-info/lsd-react/-/lsd-react-0.1.0-alpha.13.tgz#83a947aef6bf0597bb94389382bce72eda9d262e" + integrity sha512-bEtCygGvEabxr7a/0s2n9LLbs7RUY5YXFIEzxKeDH52UNhzLODY6hpOELWfpDxfd2Q0yxnMKSaG+yI7/FqjnlA== dependencies: "@emotion/react" "^11.10.5" "@emotion/styled" "^11.10.5"