diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f5c102..d041064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.0.0-alpha.4](https://github.com/acid-info/logos-docusaurus-plugins/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-06-01) + +### Bug Fixes + +- add description for Nomos website ([59d5d7b](https://github.com/acid-info/logos-docusaurus-plugins/commit/59d5d7b653fef51adfe090fe62bd1ccb29305d93)) + # [1.0.0-alpha.3](https://github.com/acid-info/logos-docusaurus-plugins/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-06-01) ### Bug Fixes diff --git a/lerna.json b/lerna.json index 08f22b4..64afa76 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "npmClient": "yarn", "useWorkspaces": true, "$schema": "node_modules/lerna/schemas/lerna-schema.json" diff --git a/packages/docusaurus-playground/docusaurus.config.js b/packages/docusaurus-playground/docusaurus.config.js index 2702c39..867ad8f 100644 --- a/packages/docusaurus-playground/docusaurus.config.js +++ b/packages/docusaurus-playground/docusaurus.config.js @@ -8,9 +8,7 @@ const config = { url: 'https://url', baseUrl: '/', - customFields: { - ghostAPiKey: process.env.GHOST_API_KEY, - }, + customFields: {}, markdown: { mermaid: true, }, @@ -28,11 +26,18 @@ const config = { '@acid-info/logos-docusaurus-preset', /** @type {import('@acid-info/logos-docusaurus-preset').PluginOptions} */ ({ - businessUnit: 'Nimbus', + businessUnit: 'Waku', theme: { name: 'default', options: { customCss: [require.resolve('./src/css/custom.scss')], + docs: { + default: { + sidebar: { + hide: true, + }, + }, + }, }, }, docs: { @@ -52,10 +57,6 @@ const config = { themeConfig: /** @type {import('@acid-info/logos-docusaurus-preset').ThemeConfig} */ ({ - colorMode: { - defaultMode: 'dark', - disableSwitch: false, - }, navbar: { items: [ { diff --git a/packages/docusaurus-playground/package.json b/packages/docusaurus-playground/package.json index 2d0ddea..5880225 100644 --- a/packages/docusaurus-playground/package.json +++ b/packages/docusaurus-playground/package.json @@ -15,7 +15,7 @@ "typecheck": "tsc" }, "dependencies": { - "@acid-info/logos-docusaurus-preset": "^1.0.0-alpha.0", + "@acid-info/logos-docusaurus-preset": "^1.0.0-alpha.4", "@docusaurus/core": "2.4.1", "@docusaurus/preset-classic": "2.4.1", "@docusaurus/theme-mermaid": "^2.4.1", diff --git a/packages/docusaurus-playground/src/pages/index.mdx b/packages/docusaurus-playground/src/pages/index.mdx index d78fde3..8dd1fe1 100644 --- a/packages/docusaurus-playground/src/pages/index.mdx +++ b/packages/docusaurus-playground/src/pages/index.mdx @@ -5,10 +5,12 @@ import { HeroActions, HeroAction, CallToActionSection, + CallToActionButton, FeatureList, Showcase, HeroModel, HeroInfo, + Box, } from '../components/mdx' @@ -32,14 +34,13 @@ import { @@ -68,41 +69,77 @@ import { "Waku's native incentivization mechanisms ensure a wide node distribution, making it highly secure and strengthening its privacy assurances.", }, ]} -/> +> + + Decentralize your DApp + + - + + + - + + + - + + + + + + + + + + + diff --git a/packages/docusaurus-playground/static/hero/architecture01/hi.gbl b/packages/docusaurus-playground/static/hero/architecture01/hi.gbl new file mode 100644 index 0000000..b07454d Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture01/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture01/lo.gbl b/packages/docusaurus-playground/static/hero/architecture01/lo.gbl new file mode 100644 index 0000000..b07454d Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture01/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture02/hi.gbl b/packages/docusaurus-playground/static/hero/architecture02/hi.gbl new file mode 100644 index 0000000..77d2ce7 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture02/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture02/lo.gbl b/packages/docusaurus-playground/static/hero/architecture02/lo.gbl new file mode 100644 index 0000000..77d2ce7 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture02/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture03/hi.gbl b/packages/docusaurus-playground/static/hero/architecture03/hi.gbl new file mode 100644 index 0000000..f0cdb2b Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture03/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture03/lo.gbl b/packages/docusaurus-playground/static/hero/architecture03/lo.gbl new file mode 100644 index 0000000..f0cdb2b Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture03/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture04/hi.gbl b/packages/docusaurus-playground/static/hero/architecture04/hi.gbl new file mode 100644 index 0000000..f3139c6 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture04/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture04/lo.gbl b/packages/docusaurus-playground/static/hero/architecture04/lo.gbl new file mode 100644 index 0000000..bebb2e7 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture04/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture05/hi.gbl b/packages/docusaurus-playground/static/hero/architecture05/hi.gbl new file mode 100644 index 0000000..8a925be Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture05/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture05/lo.gbl b/packages/docusaurus-playground/static/hero/architecture05/lo.gbl new file mode 100644 index 0000000..b8b7ddb Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture05/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture06/hi.gbl b/packages/docusaurus-playground/static/hero/architecture06/hi.gbl new file mode 100644 index 0000000..caaefde Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture06/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture06/lo.gbl b/packages/docusaurus-playground/static/hero/architecture06/lo.gbl new file mode 100644 index 0000000..caaefde Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture06/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture07/hi.gbl b/packages/docusaurus-playground/static/hero/architecture07/hi.gbl new file mode 100644 index 0000000..697f119 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture07/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/architecture07/lo.gbl b/packages/docusaurus-playground/static/hero/architecture07/lo.gbl new file mode 100644 index 0000000..697f119 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/architecture07/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bulanding-generic-atlas-01.glb b/packages/docusaurus-playground/static/hero/atlas/hi.gbl similarity index 100% rename from packages/docusaurus-playground/static/hero/bulanding-generic-atlas-01.glb rename to packages/docusaurus-playground/static/hero/atlas/hi.gbl diff --git a/packages/docusaurus-playground/static/hero/atlas/lo.gbl b/packages/docusaurus-playground/static/hero/atlas/lo.gbl new file mode 100644 index 0000000..0adfed0 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/atlas/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bust01/hi.gbl b/packages/docusaurus-playground/static/hero/bust01/hi.gbl new file mode 100644 index 0000000..2eedb60 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/bust01/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bust01/lo.gbl b/packages/docusaurus-playground/static/hero/bust01/lo.gbl new file mode 100644 index 0000000..2eedb60 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/bust01/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bust02/hi.gbl b/packages/docusaurus-playground/static/hero/bust02/hi.gbl new file mode 100644 index 0000000..00955a2 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/bust02/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bust02/lo.gbl b/packages/docusaurus-playground/static/hero/bust02/lo.gbl new file mode 100644 index 0000000..e67bfe1 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/bust02/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bust03/hi.gbl b/packages/docusaurus-playground/static/hero/bust03/hi.gbl new file mode 100644 index 0000000..77b847e Binary files /dev/null and b/packages/docusaurus-playground/static/hero/bust03/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bust03/lo.gbl b/packages/docusaurus-playground/static/hero/bust03/lo.gbl new file mode 100644 index 0000000..a449f7d Binary files /dev/null and b/packages/docusaurus-playground/static/hero/bust03/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/discobolus/hi.gbl b/packages/docusaurus-playground/static/hero/discobolus/hi.gbl new file mode 100644 index 0000000..ea2ec28 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/discobolus/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/discobolus/lo.gbl b/packages/docusaurus-playground/static/hero/discobolus/lo.gbl new file mode 100644 index 0000000..f3c80c0 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/discobolus/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bulanding-generic-hand-01.glb b/packages/docusaurus-playground/static/hero/hand/hi.gbl similarity index 100% rename from packages/docusaurus-playground/static/hero/bulanding-generic-hand-01.glb rename to packages/docusaurus-playground/static/hero/hand/hi.gbl diff --git a/packages/docusaurus-playground/static/hero/hand/lo.gbl b/packages/docusaurus-playground/static/hero/hand/lo.gbl new file mode 100644 index 0000000..5492ee5 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/hand/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/bulanding-generic-vase-02.glb b/packages/docusaurus-playground/static/hero/vase01/hi.gbl similarity index 100% rename from packages/docusaurus-playground/static/hero/bulanding-generic-vase-02.glb rename to packages/docusaurus-playground/static/hero/vase01/hi.gbl diff --git a/packages/docusaurus-playground/static/hero/vase01/lo.gbl b/packages/docusaurus-playground/static/hero/vase01/lo.gbl new file mode 100644 index 0000000..30f50f0 Binary files /dev/null and b/packages/docusaurus-playground/static/hero/vase01/lo.gbl differ diff --git a/packages/docusaurus-playground/static/hero/venus/hi.gbl b/packages/docusaurus-playground/static/hero/venus/hi.gbl new file mode 100644 index 0000000..a9fe31e Binary files /dev/null and b/packages/docusaurus-playground/static/hero/venus/hi.gbl differ diff --git a/packages/docusaurus-playground/static/hero/venus/lo.gbl b/packages/docusaurus-playground/static/hero/venus/lo.gbl new file mode 100644 index 0000000..2df429a Binary files /dev/null and b/packages/docusaurus-playground/static/hero/venus/lo.gbl differ diff --git a/packages/docusaurus-playground/static/showcase/the-graph-mark-white.svg b/packages/docusaurus-playground/static/showcase/the-graph-mark-white.svg new file mode 100644 index 0000000..b742361 --- /dev/null +++ b/packages/docusaurus-playground/static/showcase/the-graph-mark-white.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/logos-docusaurus-preset/CHANGELOG.md b/packages/logos-docusaurus-preset/CHANGELOG.md index a71b087..6cb800b 100644 --- a/packages/logos-docusaurus-preset/CHANGELOG.md +++ b/packages/logos-docusaurus-preset/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.0.0-alpha.4](https://github.com/acid-info/logos-docusaurus-plugins/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-06-01) + +### Bug Fixes + +- add description for Nomos website ([59d5d7b](https://github.com/acid-info/logos-docusaurus-plugins/commit/59d5d7b653fef51adfe090fe62bd1ccb29305d93)) + # [1.0.0-alpha.3](https://github.com/acid-info/logos-docusaurus-plugins/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-06-01) ### Bug Fixes diff --git a/packages/logos-docusaurus-preset/package.json b/packages/logos-docusaurus-preset/package.json index efc88c4..878870f 100644 --- a/packages/logos-docusaurus-preset/package.json +++ b/packages/logos-docusaurus-preset/package.json @@ -1,6 +1,6 @@ { "name": "@acid-info/logos-docusaurus-preset", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Docusaurus preset for Logos documentation websites", "main": "lib/index.js", "types": "src/preset.d.ts", @@ -17,7 +17,7 @@ }, "dependencies": { "@acid-info/logos-docusaurus-search-local": "^1.0.0-alpha.0", - "@acid-info/logos-docusaurus-theme": "^1.0.0-alpha.3", + "@acid-info/logos-docusaurus-theme": "^1.0.0-alpha.4", "@docusaurus/core": "^2.4.1", "@docusaurus/module-type-aliases": "^2.4.1", "@docusaurus/preset-classic": "^2.4.1", diff --git a/packages/logos-docusaurus-preset/src/theme-config/nomos.ts b/packages/logos-docusaurus-preset/src/theme-config/nomos.ts index a4ad4f7..82408fe 100644 --- a/packages/logos-docusaurus-preset/src/theme-config/nomos.ts +++ b/packages/logos-docusaurus-preset/src/theme-config/nomos.ts @@ -16,7 +16,8 @@ export const nomosThemeConfig: typeof baseThemeConfig = { { name: 'keywords', content: 'Nomos' }, { name: 'description', - content: '', + content: + "Nomos supports the demands of aspiring network states, defending self-determination at the network level for humanity's underserved.", }, { name: 'image', content: 'theme/image/preview-image.png' }, ], diff --git a/packages/logos-docusaurus-theme/CHANGELOG.md b/packages/logos-docusaurus-theme/CHANGELOG.md index 8665df6..2fa6998 100644 --- a/packages/logos-docusaurus-theme/CHANGELOG.md +++ b/packages/logos-docusaurus-theme/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.0.0-alpha.4](https://github.com/acid-info/logos-docusaurus-plugins/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-06-01) + +**Note:** Version bump only for package @acid-info/logos-docusaurus-theme + # [1.0.0-alpha.3](https://github.com/acid-info/logos-docusaurus-plugins/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-06-01) ### Bug Fixes diff --git a/packages/logos-docusaurus-theme/package.json b/packages/logos-docusaurus-theme/package.json index 5a41031..f6425f2 100644 --- a/packages/logos-docusaurus-theme/package.json +++ b/packages/logos-docusaurus-theme/package.json @@ -1,6 +1,6 @@ { "name": "@acid-info/logos-docusaurus-theme", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "A Docusaurus theme for Logos documentation websites", "main": "lib/index.js", "types": "src/theme.d.ts", @@ -20,7 +20,7 @@ "prepublishOnly": "yarn clean && yarn build" }, "dependencies": { - "@acid-info/logos-docusaurus-preset": "^1.0.0-alpha.3", + "@acid-info/logos-docusaurus-preset": "^1.0.0-alpha.4", "@acid-info/lsd-react": "^0.1.0-alpha.8", "@docusaurus/core": "^2.4.1", "@docusaurus/mdx-loader": "^2.4.1", diff --git a/packages/logos-docusaurus-theme/src/client/components/Modal/Modal.tsx b/packages/logos-docusaurus-theme/src/client/components/Modal/Modal.tsx index e1d69e8..560e9d2 100644 --- a/packages/logos-docusaurus-theme/src/client/components/Modal/Modal.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/Modal/Modal.tsx @@ -1,4 +1,3 @@ -import { useLockBodyScroll } from '@docusaurus/theme-common/internal' import clsx from 'clsx' import React from 'react' import { useKeyPressEvent } from 'react-use' @@ -26,7 +25,6 @@ export const Modal: React.FC = ({ onClose && onClose() } - useLockBodyScroll(open) useKeyPressEvent( (key) => key.code === 'Escape', (event) => { diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/Box/Box.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/Box/Box.scss new file mode 100644 index 0000000..d0888c8 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/Box/Box.scss @@ -0,0 +1,32 @@ +@use '../../../css/utils'; +@use '../../../css/lsd'; + +.mdx-box { + padding-top: var(--mdx-box-top); + padding-bottom: var(--mdx-box-bottom); + + @include utils.responsive('xs', 'up') { + --mdx-box-top: var(--mdx-box-top-xs); + --mdx-box-bottom: var(--mdx-box-bottom-xs); + } + + @include utils.responsive('sm', 'up') { + --mdx-box-top: var(--mdx-box-top-sm); + --mdx-box-bottom: var(--mdx-box-bottom-sm); + } + + @include utils.responsive('md', 'up') { + --mdx-box-top: var(--mdx-box-top-md); + --mdx-box-bottom: var(--mdx-box-bottom-md); + } + + @include utils.responsive('lg', 'up') { + --mdx-box-top: var(--mdx-box-top-lg); + --mdx-box-bottom: var(--mdx-box-bottom-lg); + } + + @include utils.responsive('xl', 'up') { + --mdx-box-top: var(--mdx-box-top-xl); + --mdx-box-bottom: var(--mdx-box-bottom-xl); + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/Box/Box.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/Box/Box.tsx new file mode 100644 index 0000000..b6162e6 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/Box/Box.tsx @@ -0,0 +1,68 @@ +import clsx from 'clsx' +import React from 'react' +import { makeStyle } from '../../../lib/makeStyle' +import './Box.scss' + +type BreakpointsStyle = { + xs?: T + sm?: T + md?: T + lg?: T + xl?: T +} + +function vars( + key: string, + _val: BreakpointsStyle | string | number, + defaultValue: string | number, + unit?: string, +) { + const val = + typeof _val === 'string' || typeof _val === 'number' ? { xs: _val } : _val + + const variables: string[][] = [] + + const format = (value: any) => { + return typeof value === 'number' && unit ? `${value}${unit}` : `${value}` + } + + ;['xs', 'sm', 'md', 'lg', 'xl'].forEach((bp, index) => { + const value = val[bp] + if (!value) { + const prev = variables[index - 1]?.[1] + variables.push([`${key}-${bp}`, prev ? prev : format(defaultValue)]) + } else variables.push([`${key}-${bp}`, format(value)]) + }) + + return Object.fromEntries(variables) +} + +export type BoxProps = React.HTMLAttributes & { + top?: BreakpointsStyle | number + bottom?: BreakpointsStyle | number +} + +export const Box: React.FC = ({ + top = 0, + bottom = 0, + className, + style = {}, + children, + ...props +}) => { + return ( +
+ {children} +
+ ) +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/Box/index.ts b/packages/logos-docusaurus-theme/src/client/components/mdx/Box/index.ts new file mode 100644 index 0000000..332601e --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/Box/index.ts @@ -0,0 +1 @@ +export * from './Box' diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/CallToActionButton.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/CallToActionButton.scss new file mode 100644 index 0000000..55e8a47 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/CallToActionButton.scss @@ -0,0 +1,30 @@ +@use '../../../css/utils'; +@use '../../../css/lsd'; + +.mdx-cta-button { + margin-top: 2rem; + + &:hover { + &, + * { + text-decoration: none !important; + } + } + + button, + button span { + font-size: inherit; + line-height: inherit; + font-weight: inherit; + } +} + +@include utils.responsive('lg', 'down') { + .mdx-cta-button { + @include lsd.typography('label2'); + + button { + padding: 6px 12px; + } + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/CallToActionButton.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/CallToActionButton.tsx new file mode 100644 index 0000000..a4dcf82 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/CallToActionButton.tsx @@ -0,0 +1,36 @@ +import { Button, ButtonProps, Typography } from '@acid-info/lsd-react' +import clsx from 'clsx' +import React from 'react' +import './CallToActionButton.scss' + +export type CallToActionButtonProps = Omit< + React.HTMLAttributes, + 'title' +> & { + href?: string + size?: ButtonProps['size'] + variant?: ButtonProps['variant'] +} + +export const CallToActionButton: React.FC = ({ + href, + className, + variant = 'filled', + size = 'large', + children, + ...props +}) => { + return ( + + + + ) +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/index.ts b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/index.ts new file mode 100644 index 0000000..b6e1a3d --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionButton/index.ts @@ -0,0 +1 @@ +export * from './CallToActionButton' diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.scss index 3df3968..2a8dbb3 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.scss @@ -1,16 +1,17 @@ @use '../../../css/utils'; +@use '../../../css/lsd'; .mdx-cta-section { display: grid; - margin-top: 260px; - padding-top: 1.5rem; border-top: 1px solid rgb(var(--lsd-border-primary)); } .mdx-cta-section__title { + margin-top: 1.5rem; } .mdx-cta-section__description { + margin-top: 2rem; } .mdx-cta-section__link { @@ -25,16 +26,22 @@ } .mdx-cta-section--with-description { +} + +.mdx-cta-section--cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); + padding-top: 1.5rem; .mdx-cta-section__title { grid-column: 1 / 2; + margin-top: 0; } .mdx-cta-section__description { grid-column: 2 / 3; + margin-top: 0; } .mdx-cta-section__link { @@ -50,3 +57,36 @@ } } } + +@include utils.responsive('lg', 'down') { + .mdx-cta-section { + display: flex; + flex-direction: column; + align-items: flex-start; + } + + .mdx-cta-section__title { + @include lsd.typography('subtitle1'); + margin-top: 1rem; + } + + .mdx-cta-section__description { + @include lsd.typography('h5'); + margin-top: 1.5rem !important; + } + + .mdx-cta-section__link { + @include lsd.typography('label2'); + margin-top: 2rem; + + button { + padding: 6px 12px; + } + } + + .mdx-cta-section:not(.mdx-cta-section--with-description) { + .mdx-cta-section__title { + @include lsd.typography('h5'); + } + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.tsx index be06d98..7ef5375 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/CallToActionSection/CallToActionSection.tsx @@ -1,6 +1,7 @@ import { Button, Typography } from '@acid-info/lsd-react' import clsx from 'clsx' import React from 'react' +import { CallToActionButton } from '../index' import './CallToActionSection.scss' export type CallToActionSectionProps = Omit< @@ -9,6 +10,7 @@ export type CallToActionSectionProps = Omit< > & { title?: React.ReactNode description?: React.ReactNode + columns?: 1 | 2 href?: string label?: string } @@ -17,49 +19,43 @@ export const CallToActionSection: React.FC = ({ label, href, title = '', + columns = 1, description, className, children, ...props }) => { + const singleCol = columns === 1 + return (
{title} {description && ( {description} )} - - - + + {label} +
) } diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.scss index 7605a8e..b47530f 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.scss @@ -1,3 +1,6 @@ +@use '../../../css/utils'; +@use '../../../css/lsd'; + .mdx-feature-list { border-top: 1px solid rgb(var(--lsd-surface-secondary)); position: relative; @@ -44,3 +47,58 @@ .mdx-feature-list__feature-description { margin-top: 8.625rem; } + +.mdx-feature-list__extra { + margin-top: 3.5rem; + padding: 0 1rem; +} + +@include utils.responsive('lg', 'down') { + .mdx-feature-list { + } + + .mdx-feature-list__extra { + margin-top: 2rem; + padding: 0; + } + + .mdx-feature-list__title { + @include lsd.typography('subtitle1'); + padding: 1rem 0; + } + + .mdx-feature-list__list { + grid-template-columns: 1fr; + } + + .mdx-feature-list__feature { + border: none; + padding: 1.5rem 0; + border-top: 1px solid rgb(var(--lsd-border-primary)); + + .mdx-feature-list__feature-index { + @include lsd.typography('subtitle2'); + width: 1.625rem; + height: 1.625rem; + } + + .mdx-feature-list__feature-title { + @include lsd.typography('h5'); + margin-top: 1rem; + } + + .mdx-feature-list__feature-description { + @include lsd.typography('subtitle1'); + margin-top: 3rem; + } + + .mdx-feature-list__feature-inner { + } + + &:nth-child(odd) { + .mdx-feature-list__feature-inner { + border: none; + } + } + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.tsx index c4784bc..1c7c1c4 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/FeatureList/FeatureList.tsx @@ -27,7 +27,7 @@ export const FeatureList: React.FC = ({
{title} @@ -45,14 +45,14 @@ export const FeatureList: React.FC = ({ {feature.title} {feature.description} @@ -61,6 +61,7 @@ export const FeatureList: React.FC = ({
))} +
{children}
) } diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/Hero/Hero.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/Hero/Hero.scss index 6527679..c312407 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/Hero/Hero.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/Hero/Hero.scss @@ -1,6 +1,5 @@ .mdx-hero { position: relative; - border-top: 1px solid rgb(var(--lsd-surface-secondary)); } .mdx-hero--large { diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroAction/HeroAction.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroAction/HeroAction.scss index 9c326e6..9faed4e 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroAction/HeroAction.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroAction/HeroAction.scss @@ -1,4 +1,4 @@ -@use '../../../css/lsd'; +@use '../../../css/utils'; .mdx-hero-action { } @@ -8,3 +8,11 @@ padding: 10px 64px; } } + +@include utils.responsive('lg', 'down') { + .mdx-hero-action { + button { + padding: 6px 12px !important; + } + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroActions/HeroActions.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroActions/HeroActions.scss index 23efa06..6769c9e 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroActions/HeroActions.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroActions/HeroActions.scss @@ -1,3 +1,5 @@ +@use '../../../css/utils'; + .mdx-hero-actions { margin-top: 2rem; display: flex; @@ -8,3 +10,20 @@ position: relative; z-index: 98; } + +@include utils.responsive('lg', 'down') { + .mdx-hero-actions { + width: 100%; + margin-top: 1.5rem; + display: flex; + flex-direction: row; + align-items: center; + justify-content: stretch; + + > a, + > a > button { + display: block; + width: 100%; + } + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroDescription/HeroDescription.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroDescription/HeroDescription.scss index a5e6e43..29bb2ad 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroDescription/HeroDescription.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroDescription/HeroDescription.scss @@ -1,5 +1,11 @@ +@use '../../../css/utils'; +@use '../../../css/lsd'; + .mdx-hero-description { + // we need position relative because we need the z-index to work in order to keep it under the hero model + position: relative; z-index: -2; + font-weight: 100 !important; } .mdx-hero-description--small { @@ -7,6 +13,16 @@ } .mdx-hero-description--large { - font-size: 5.0625rem !important; - line-height: 5.5rem !important; + // font-size: 5.0625rem !important; + // line-height: 5.5rem !important; +} + +@include utils.responsive('lg', 'down') { + .mdx-hero-description { + @include lsd.typography('h3'); + } + + .mdx-hero-description--large { + font-size: 1.875rem !important; + } } diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroInfo/HeroInfo.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroInfo/HeroInfo.tsx index 3d24048..ad77f2d 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroInfo/HeroInfo.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroInfo/HeroInfo.tsx @@ -12,7 +12,7 @@ export type HeroInfoProps = PropsWithChildren< } const calcMaxOffsetY = () => { - return window.innerHeight * 0.33 + return window.innerHeight * 0.1 } export const HeroInfo: React.FC = ({ size: sizeProp, diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/Ascii.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/Ascii.tsx new file mode 100644 index 0000000..9b2378e --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/Ascii.tsx @@ -0,0 +1,73 @@ +import { AsciiConfigs } from '../../../types/ui.types' +import { defaultAsciiConfigs } from './HeroModel.configs' +import { useFrame, useThree } from '@react-three/fiber' +import React, { useEffect, useLayoutEffect, useMemo } from 'react' +import { AsciiEffect } from 'three-stdlib' +import { generateTextShadow } from '../../../lib/ui.utils' + +function useAsciiEffect(config: AsciiConfigs = {}) { + const { + renderIndex = defaultAsciiConfigs.renderIndex, + characters = defaultAsciiConfigs.characters, + invert = defaultAsciiConfigs.invert, + color = defaultAsciiConfigs.color, + resolution = defaultAsciiConfigs.resolution, + bgColor = defaultAsciiConfigs.bgColor, + fgColor = defaultAsciiConfigs.fgColor, + textShadowSize = defaultAsciiConfigs.textShadowSize, + withTextShadow = false, + } = config + const { gl, size, scene, camera, viewport } = useThree() + + const effect = useMemo(() => { + const effect = new AsciiEffect(gl, characters, { + invert, + color, + resolution, + }) + effect.domElement.style.position = 'absolute' + effect.domElement.style.top = '0px' + effect.domElement.style.left = '0px' + effect.domElement.style.pointerEvents = 'none' + return effect + }, [characters, invert, color, resolution]) + + useLayoutEffect(() => { + effect.domElement.style.color = fgColor + // effect.domElement.style.backgroundColor = bgColor + }, [fgColor, bgColor]) + + // Append on mount, remove on unmount + useEffect(() => { + gl.domElement.style.opacity = '0' + gl.domElement.parentNode!.appendChild(effect.domElement) + + if (withTextShadow) { + const style = document.createElement('style') + style.innerHTML = `table *{text-shadow: ${generateTextShadow( + textShadowSize, + )};` + effect.domElement.appendChild(style) + } + + return () => { + gl.domElement.style.opacity = '1' + gl.domElement.parentNode!.removeChild(effect.domElement) + } + }, [effect]) + + // Set size + useEffect(() => { + effect.setSize(size.width, size.height) + }, [effect, size]) + + // Take over render-loop (that is what the index is for) + useFrame((state) => { + effect.render(scene, camera) + }, renderIndex) +} + +export const AsciiRenderer = (configs: AsciiConfigs) => { + useAsciiEffect(configs) + return <> +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/Controls.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/Controls.tsx new file mode 100644 index 0000000..97f20d6 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/Controls.tsx @@ -0,0 +1,120 @@ +import { ROTATE_SPEED } from './HeroModel.configs' +import { MovementProps } from '../../../types/ui.types' +import React, { useEffect, useRef } from 'react' +import { useScrollY } from '../../../lib/useScrollY' +import { useFrame, useThree } from '@react-three/fiber' +import { calcRotateSpeed } from './HeroModel.utils' +import { OrbitControls } from '@react-three/drei' + +class Vector3 { + x: number + y: number + z: number + + constructor(x: number, y: number, z: number) { + this.x = x + this.y = y + this.z = z + } + + subtract(v: Vector3) { + return new Vector3(this.x - v.x, this.y - v.y, this.z - v.z) + } + + add(v: Vector3) { + return new Vector3(this.x + v.x, this.y + v.y, this.z + v.z) + } + + multiplyScalar(s: number) { + return new Vector3(this.x * s, this.y * s, this.z * s) + } + + clone() { + return new Vector3(this.x, this.y, this.z) + } + + toArray() { + return [this.x, this.y, this.z] + } +} + +const lerp = (a: number, b: number, t: number) => (1 - t) * a + t * b +let targetPos: [number, number, number] = [0, 0, 0] + +function calculateCameraPosition(scrollY: number): [number, number, number] { + const baseXZ = -1.6 // Base x and z component at scrollY = 0 + const baseY = 4.04 // Base y component at scrollY = 0 + const rateXZ = -0.01 // Rate of change for x and z components + const rateY = 0.00185 // Rate of change for y component + const deltaX = baseXZ + rateXZ * scrollY - baseXZ + const deltaY = baseY + rateY * scrollY - baseY + const deltaZ = baseXZ + rateXZ * scrollY - baseXZ + return [deltaX, deltaY, deltaZ] +} +export const Controls = ({ + rotateSpeed = ROTATE_SPEED, + enableZoom = true, + enableRotateOnScroll = true, + preset, + children, + ...props +}: MovementProps) => { + const ref = useRef() + const scrollY = useScrollY() + const { camera, size } = useThree() + const controls = useRef() + + useFrame((state, delta) => { + const speed = enableRotateOnScroll + ? calcRotateSpeed(scrollY, rotateSpeed) + : rotateSpeed + ref.current.rotation.y += delta * speed + }) + + useEffect(() => { + const onClick = () => { + console.log( + JSON.stringify( + { + cameraPos: camera.position.toArray(), + cameraRot: camera.rotation.toArray().slice(0, 3), + controlsTarget: controls.current.target.toArray(), + }, + null, + 2, + ), + ) + } + + window.addEventListener('click', onClick) + return () => window.removeEventListener('click', onClick) + }, [camera]) + + useEffect(() => { + const [deltaX, deltaY, deltaZ] = calculateCameraPosition(scrollY) + + // Add the deltas to the initial positions + const newPositionX = preset.cameraPos[0] + deltaX + const newPositionY = preset.cameraPos[1] + deltaY + const newPositionZ = preset.cameraPos[2] + deltaZ + + camera.position.set(newPositionX, newPositionY, newPositionZ) + camera.updateProjectionMatrix() + + // const scale = mapFloat(scrollY, 0, calcScrollThreshold(), 1, 0.5); + // const initialPosition = ref.current.position.clone(); + // ref.current.scale.set(scale, scale, scale); + // ref.current.position.y += 0.0001 * scale; + }, [scrollY, camera]) + + return ( + + {children} + + + ) +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.configs.ts b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.configs.ts new file mode 100644 index 0000000..ce8439e --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.configs.ts @@ -0,0 +1,260 @@ +import { LookPresetItem, LookPresetItemValues } from '../../../types/ui.types' + +export let ROTATE_SPEED = 0.1 +export const MIN_ROTATE_SPEED = 0 +export const MAX_ROTATE_SPEED = 1 +export const MAX_Z = 20 * 1.4 // or another value that suits your needs +export const MIN_Z = 0.2 * 1.4 +export const MIN_Y = -0.25 +export const MAX_Y = 0.25 +export const MIN_X = -0.25 +export const MAX_X = 0.25 +export const MIN_ZOOM = 0.22 +export const RESIZE_SPEED_FACTOR = 0.9 +export const INITIAL_ZOOM = 3 + +export const defaultAsciiConfigs = { + renderIndex: 1, + bgColor: 'rgb(var(--lsd-surface-primary))', + fgColor: 'rgb(var(--lsd-text-primary))', + characters: ' l.o.g.o.s ', + invert: false, + color: false, + resolution: 0.21, + textShadowSize: 15, +} + +export const defaultPresets: { + simple: LookPresetItemValues + abstract: LookPresetItemValues +} = { + simple: { + cameraPos: [6.898858137575106, 4.772099506970454, -3.1821660872368627], + cameraRot: [-2.733342169570335, 1.127956558492365, 2.7690180385429666], + controlsTarget: [ + -0.2185887974027981, 3.4320197290105474, -0.08409377618890646, + ], + }, + abstract: { + cameraPos: [-1.4826176635786852, 4.021180061821954, -1.5929058418153597], + cameraRot: [-2.9244096935808908, -0.8625529112689497, -2.9755407843387185], + controlsTarget: [-0.3236695017538898, 3.8072918272567, -0.6236093222013962], + }, +} + +export const OBJECTS_PRESETS: LookPresetItem[] = [ + { + modelId: 'bust', + simple: { + cameraPos: [6.898858137575106, 4.772099506970454, -3.1821660872368627], + cameraRot: [-2.733342169570335, 1.127956558492365, 2.7690180385429666], + controlsTarget: [ + -0.2185887974027981, 3.4320197290105474, -0.08409377618890646, + ], + }, + abstract: { + cameraPos: [-1.4826176635786852, 4.021180061821954, -1.5929058418153597], + cameraRot: [ + -2.9244096935808908, -0.8625529112689497, -2.9755407843387185, + ], + controlsTarget: [ + -0.3236695017538898, 3.8072918272567, -0.6236093222013962, + ], + }, + }, + { + modelId: 'architecture01', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'architecture02', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'architecture03', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'architecture04', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'architecture05', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'architecture06', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'architecture07', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'atlas', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'bust01', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'bust02', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'bust03', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'discobolus', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'hand', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'vase01', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, + { + modelId: 'venus', + simple: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + abstract: { + cameraPos: [0, 0, 0], + cameraRot: [0, 0, 0], + controlsTarget: [0, 0, 0], + }, + }, +] diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.scss index 9d484c0..165c2a8 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.scss @@ -5,63 +5,42 @@ ); position: absolute; top: calc(var(--logos-hero-info-height) - 10px); - z-index: -1; + z-index: 0; .mdx-hero-model--inner { position: relative; width: 100%; - height: 1400px; z-index: 0; left: 0; top: 0; - //transition: translate 0.6s ease-in-out; - canvas { - pointer-events: none; - } - } -} - -.mdx-hero-model--cropped { -} - -.mdx-hero-model--floating { - .mdx-hero-model--inner { canvas { pointer-events: unset !important; } } } -.mdx-hero-model--3d { - overflow: visible !important; +.mdx-hero-model--simple { +} - .mdx-hero-model--inner { - position: relative; - } - - .mdx-hero-model--inner { - > div { - position: absolute; - top: 50%; - left: 50%; - transform: scale(1.2) translate(-50%, -50%); - } - } +.mdx-hero-model--abstract { } .mdx-hero-model--ascii { + filter: grayscale(100%); table { &, * { border: none !important; font-family: monospace; + //text-shadow: -5px 5px 0px #d5d5d5, -10px 10px 0px #01cccc, -15px 15px 0px #00bdbd, 2px 2px 2px rgba(206,89,55,0); + color: #ffffff; } } } .mdx-hero-model--shade { width: 100%; - height: 600px; + height: 60vh; position: absolute; background: linear-gradient( 0deg, @@ -69,6 +48,6 @@ rgb(0, 0, 0) 0%, rgba(0, 0, 0, 0) 100% ); - bottom: 500px; + bottom: -0; left: 0; } diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.tsx index 7babd53..e4951c5 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.tsx @@ -1,284 +1,119 @@ -import { OrbitControls, useGLTF } from '@react-three/drei' -import { Canvas, useFrame, useThree } from '@react-three/fiber' +import React, { Suspense, useMemo, useRef } from 'react' +import { Canvas, useFrame } from '@react-three/fiber' +import { useGLTF } from '@react-three/drei' import clsx from 'clsx' -import React, { - PropsWithChildren, - Suspense, - useEffect, - useLayoutEffect, - useMemo, - useRef, - useState, -} from 'react' -import * as THREE from 'three' -import { AsciiEffect } from 'three-stdlib' -import './HeroModel.scss' + import { - calcScrollThreshold, - isTouchDevice, - mapFloat, - random, -} from '../../../lib/ui.utils' + defaultPresets, + OBJECTS_PRESETS, + RESIZE_SPEED_FACTOR, + ROTATE_SPEED, +} from './HeroModel.configs' +import { AsciiConfigs, LookPresetItemValues } from '../../../types/ui.types' + +import './HeroModel.scss' +import { AsciiRenderer } from './Ascii' +import { Controls } from './Controls' +import { calcScrollThreshold, mapFloat } from '../../../lib/ui.utils' import { useScrollY } from '../../../lib/useScrollY' -let ROTATE_SPEED = 0.1 -const MIN_ROTATE_SPEED = 0.1 -const MAX_ROTATE_SPEED = 1 - -const MAX_Z = 20 * 1.4 // or another value that suits your needs -const MIN_Z = 0.2 * 1.4 -const MIN_Y = -0.25 -const MAX_Y = 0.25 -const MIN_X = -0.25 -const MAX_X = 0.25 - -const MIN_ZOOM = 0.22 -const RESIZE_SPEED_FACTOR = 0.9 -const INITIAL_ZOOM = 3 -const calcZoom = (scrollY = 0, initZ = INITIAL_ZOOM) => { - return Math.max( - mapFloat( - scrollY, - 0, - calcScrollThreshold() * RESIZE_SPEED_FACTOR, - initZ, - MIN_ZOOM, - ), - MIN_ZOOM, - ) -} - -const calcRotateSpeed = (scrollY = 0, speed) => { - const sFactor = mapFloat(scrollY, 0, window.innerHeight, 1, 10) - return Math.max(Math.min(speed * sFactor, MAX_ROTATE_SPEED), MIN_ROTATE_SPEED) -} - -function Model({ url, ...props }) { - // useGLTF suspends the component, it literally stops processing - const { scene } = useGLTF(url) as any - // useLayoutEffect(() => { - // if (!camera) return - // const c = camera as THREE.PerspectiveCamera - // const fov = c.fov * (Math.PI / 180) - // const distance = Math.abs(Math.max(size.x, size.y) / Math.sin(fov / 2)) - // c.position.setZ(distance) - // }, [size, camera]) - return ( - - ) -} - -type RotateProps = PropsWithChildren<{ - initialZ?: number - rotateSpeed?: number - enableZoom?: boolean - enableRotateOnScroll?: boolean -}> - -function Movements({ - initialZ, - rotateSpeed = ROTATE_SPEED, - enableZoom = true, - enableRotateOnScroll = true, - ...props -}: RotateProps) { - const ref = useRef() - const scrollY = useScrollY() - - useFrame((state, delta) => { - // const f = mapFloat(scrollY, 0, 1000, 1, 2); - // ref.current.rotation.x += delta * (ROTATE_SPEED); - // ref.current.rotation.y += delta * (ROTATE_SPEED); - const speed = enableRotateOnScroll - ? calcRotateSpeed(scrollY, rotateSpeed) - : rotateSpeed - ref.current.rotation.y += delta * speed - }) - - return ( - - ) -} - -type AsciiConfigs = { - characters?: string - invert?: boolean - color?: boolean - bgColor?: string - fgColor?: string - resolution?: number - renderIndex?: number -} - -const defaultAsciiConfigs = { - renderIndex: 1, - bgColor: 'rgb(var(--lsd-surface-primary))', - fgColor: 'rgb(var(--lsd-text-primary))', - characters: ' l.o.g.o.s', - invert: false, - color: false, - resolution: 0.2, -} - -type AsciiEffectProps = { - config?: AsciiConfigs - initialZ?: number -} - -function useAsciiEffect({ config = {}, initialZ }: AsciiEffectProps) { - const { - renderIndex = defaultAsciiConfigs.renderIndex, - characters = defaultAsciiConfigs.characters, - invert = defaultAsciiConfigs.invert, - color = defaultAsciiConfigs.color, - resolution = defaultAsciiConfigs.resolution, - bgColor = defaultAsciiConfigs.bgColor, - fgColor = defaultAsciiConfigs.fgColor, - } = config - - // Reactive state - const { gl, size, scene, camera, viewport } = useThree() - - const effect = useMemo(() => { - const effect = new AsciiEffect(gl, characters, { - invert, - color, - resolution, - }) - effect.domElement.style.position = 'absolute' - effect.domElement.style.top = '0px' - effect.domElement.style.left = '0px' - effect.domElement.style.pointerEvents = 'none' - return effect - }, [characters, invert, color, resolution]) - - useLayoutEffect(() => { - effect.domElement.style.color = fgColor - // effect.domElement.style.backgroundColor = bgColor - }, [fgColor, bgColor]) - - // Append on mount, remove on unmount - useEffect(() => { - gl.domElement.style.opacity = '0' - gl.domElement.parentNode!.appendChild(effect.domElement) - return () => { - gl.domElement.style.opacity = '1' - gl.domElement.parentNode!.removeChild(effect.domElement) - } - }, [effect]) - - // Set size - useEffect(() => { - effect.setSize(size.width, size.height) - }, [effect, size]) - - // Take over render-loop (that is what the index is for) - useFrame((state) => { - effect.render(scene, camera) - }, renderIndex) -} - -const AsciiRenderer = (props: AsciiEffectProps) => { - useAsciiEffect(props) - return <> -} - export type HeroModelProps = React.HTMLAttributes & { - modelUrl: string - layout?: 'floating' | 'cropped' - renderer?: '3d' | 'ascii' + modelUrlHi: string + modelUrlLow: string + modelId?: string + preset?: LookPresetItemValues + mode?: 'simple' | 'abstract' asciiConfig?: AsciiConfigs - initialZ?: number - initialX?: number - initialY?: number rotateSpeed?: number + enableZoom?: boolean enableRotateOnScroll?: boolean withParallelEffect?: boolean } -export const HeroModel: React.FC = ({ - layout = 'floating', - renderer = '3d', - modelUrl, - className, - children, - asciiConfig, - initialX, - initialY, - initialZ, - rotateSpeed = ROTATE_SPEED, - enableZoom, - enableRotateOnScroll, - withParallelEffect, - ...props -}) => { +const useLookPreset = ( + mode: 'abstract' | 'simple', + preset?: LookPresetItemValues, + modelId?: string, +): LookPresetItemValues => { + return useMemo(() => { + if (preset) return preset + if (!modelId) return defaultPresets[mode] + const existingPreset = OBJECTS_PRESETS.find((p) => p.modelId === modelId) + return existingPreset ? existingPreset[mode] : defaultPresets[mode] + }, [preset, modelId]) +} + +const getInitialY = (mode: 'abstract' | 'simple'): number => { + return mode === 'abstract' ? 0 : -200 +} + +export const HeroModel = (props: HeroModelProps) => { + const { + modelUrlHi, + modelUrlLow, + modelId, + preset: presetProp, + mode = 'simple', + className, + children, + asciiConfig, + rotateSpeed = ROTATE_SPEED, + enableZoom, + enableRotateOnScroll, + withParallelEffect = true, + ...divProps + } = props + + const preset = useLookPreset(mode, presetProp, modelId) + // const index = 1; + // const preset = OBJECTS_PRESETS[1]? OBJECTS_PRESETS[index][mode] : defaultPresets[mode]; const scrollY = useScrollY() - const initialPosition = useMemo(() => { - if (typeof window === 'undefined') return new THREE.Vector3(0, 0, 0) - if (renderer === 'ascii') { - return new THREE.Vector3( - initialX || random(MIN_X, MAX_X), - initialY || random(MIN_Y, MAX_Y), - 0, - ) - } - // if not ascii then use the max z - return new THREE.Vector3(3.1, initialY || random(MIN_Y, MAX_Y), 0) - }, [initialX, initialY, initialZ, renderer]) return (
- - - - - - }> - - - - - {!isTouchDevice() && } - {renderer === 'ascii' && ( - - )} - + }> + + + + + + + }> + + + + + +
= ({ scrollY, 0, calcScrollThreshold() * RESIZE_SPEED_FACTOR, - 0, + 0.2, 1, ), }} @@ -295,3 +130,22 @@ export const HeroModel: React.FC = ({
) } + +function Model({ url, ...props }) { + // useGLTF suspends the component, it literally stops processing + const { scene } = useGLTF(url) as any + // By the time we're here the model is gueranteed to be available + return +} + +function Rotate(props) { + const ref = useRef() + useFrame((state) => { + if (ref.current) { + // @ts-ignore + return (ref.current.rotation.y = state.clock.elapsedTime) + } + return ref + }) + return +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.utils.ts b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.utils.ts new file mode 100644 index 0000000..003ca50 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/HeroModel.utils.ts @@ -0,0 +1,26 @@ +import { calcScrollThreshold, mapFloat } from '../../../lib/ui.utils' +import { + INITIAL_ZOOM, + MAX_ROTATE_SPEED, + MIN_ROTATE_SPEED, + MIN_ZOOM, + RESIZE_SPEED_FACTOR, +} from './HeroModel.configs' + +export const calcRotateSpeed = (scrollY = 0, speed) => { + const sFactor = mapFloat(scrollY, 0, window.innerHeight, 1, 10) + return Math.max(Math.min(speed * sFactor, MAX_ROTATE_SPEED), MIN_ROTATE_SPEED) +} + +export const calcZoom = (scrollY = 0, initZ = INITIAL_ZOOM) => { + return Math.max( + mapFloat( + scrollY, + 0, + calcScrollThreshold() * RESIZE_SPEED_FACTOR, + initZ, + MIN_ZOOM, + ), + MIN_ZOOM, + ) +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/_HeroModel.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/_HeroModel.tsx new file mode 100644 index 0000000..ab7b907 --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/_HeroModel.tsx @@ -0,0 +1,336 @@ +/* +import {OrbitControls, useGLTF} from '@react-three/drei' +import {Canvas, useFrame, useThree} from '@react-three/fiber' +import clsx from 'clsx' +import React, { + PropsWithChildren, + Suspense, + useEffect, + useLayoutEffect, + useMemo, + useRef, + useState, +} from 'react' +import * as THREE from 'three' +import {AsciiEffect} from 'three-stdlib' +import './HeroModel.scss' +import { + calcScrollThreshold, + isTouchDevice, + mapFloat, + random, +} from '../../../lib/ui.utils' +import {useScrollY} from '../../../lib/useScrollY' + +let ROTATE_SPEED = 0.1 +const MIN_ROTATE_SPEED = 0.1 +const MAX_ROTATE_SPEED = 1 + +const MAX_Z = 20 * 1.4 // or another value that suits your needs +const MIN_Z = 0.2 * 1.4 +const MIN_Y = -0.25 +const MAX_Y = 0.25 +const MIN_X = -0.25 +const MAX_X = 0.25 + +const MIN_ZOOM = 0.22 +const RESIZE_SPEED_FACTOR = 0.9 +const INITIAL_ZOOM = 3 +const calcZoom = (scrollY = 0, initZ = INITIAL_ZOOM) => { + return Math.max( + mapFloat( + scrollY, + 0, + calcScrollThreshold() * RESIZE_SPEED_FACTOR, + initZ, + MIN_ZOOM, + ), + MIN_ZOOM, + ) +} + +const calcRotateSpeed = (scrollY = 0, speed) => { + const sFactor = mapFloat(scrollY, 0, window.innerHeight, 1, 10) + return Math.max(Math.min(speed * sFactor, MAX_ROTATE_SPEED), MIN_ROTATE_SPEED) +} + +function Model({url, ...props}) { + // useGLTF suspends the component, it literally stops processing + const {scene} = useGLTF(url) as any + // useLayoutEffect(() => { + // if (!camera) return + // const c = camera as THREE.PerspectiveCamera + // const fov = c.fov * (Math.PI / 180) + // const distance = Math.abs(Math.max(size.x, size.y) / Math.sin(fov / 2)) + // c.position.setZ(distance) + // }, [size, camera]) + return ( + + ) +} + +type RotateProps = PropsWithChildren<{ + initialZ?: number + rotateSpeed?: number + enableZoom?: boolean + enableRotateOnScroll?: boolean +}> + +function Movements({ + initialZ, + rotateSpeed = ROTATE_SPEED, + enableZoom = true, + enableRotateOnScroll = true, + ...props + }: RotateProps) { + const ref = useRef() + const scrollY = useScrollY() + + useFrame((state, delta) => { + // const f = mapFloat(scrollY, 0, 1000, 1, 2); + // ref.current.rotation.x += delta * (ROTATE_SPEED); + // ref.current.rotation.y += delta * (ROTATE_SPEED); + const speed = enableRotateOnScroll + ? calcRotateSpeed(scrollY, rotateSpeed) + : rotateSpeed + ref.current.rotation.y += delta * speed + }) + + return ( + + ) +} + +type AsciiConfigs = { + characters?: string + invert?: boolean + color?: boolean + bgColor?: string + fgColor?: string + resolution?: number + renderIndex?: number +} + +const defaultAsciiConfigs = { + renderIndex: 1, + bgColor: 'rgb(var(--lsd-surface-primary))', + fgColor: 'rgb(var(--lsd-text-primary))', + characters: ' l.o.g.o.s ', + invert: false, + color: false, + resolution: 0.2, +} + +type AsciiEffectProps = { + config?: AsciiConfigs + initialZ?: number +} + +function useAsciiEffect({config = {}, initialZ}: AsciiEffectProps) { + const { + renderIndex = defaultAsciiConfigs.renderIndex, + characters = defaultAsciiConfigs.characters, + invert = defaultAsciiConfigs.invert, + color = defaultAsciiConfigs.color, + resolution = defaultAsciiConfigs.resolution, + bgColor = defaultAsciiConfigs.bgColor, + fgColor = defaultAsciiConfigs.fgColor, + } = config + + // Reactive state + const {gl, size, scene, camera, viewport} = useThree() + + const effect = useMemo(() => { + const effect = new AsciiEffect(gl, " characters ", { + invert: true, + color: false, + resolution: 0.1, + }) + effect.domElement.style.position = 'absolute' + effect.domElement.style.top = '0px' + effect.domElement.style.left = '0px' + effect.domElement.style.pointerEvents = 'none' + return effect + }, [characters, invert, color, resolution]) + + useLayoutEffect(() => { + effect.domElement.style.color = fgColor + // effect.domElement.style.backgroundColor = bgColor + }, [fgColor, bgColor]) + + // Append on mount, remove on unmount + useEffect(() => { + gl.domElement.style.opacity = '0' + gl.domElement.parentNode!.appendChild(effect.domElement) + return () => { + gl.domElement.style.opacity = '1' + gl.domElement.parentNode!.removeChild(effect.domElement) + } + }, [effect]) + + // Set size + useEffect(() => { + effect.setSize(size.width, size.height) + }, [effect, size]) + + // Take over render-loop (that is what the index is for) + useFrame((state) => { + effect.render(scene, camera) + }, renderIndex) +} + +const AsciiRenderer = (props: AsciiEffectProps) => { + useAsciiEffect(props) + return <> +} + +export type HeroModelProps = React.HTMLAttributes & { + modelUrl: string + layout?: 'floating' | 'cropped' + renderer?: '3d' | 'ascii' + asciiConfig?: AsciiConfigs + initialZ?: number + initialX?: number + initialY?: number + rotateSpeed?: number + enableZoom?: boolean + enableRotateOnScroll?: boolean + withParallelEffect?: boolean +} + +function Box(props) { + // This reference will give us direct access to the mesh + const mesh = useRef() + // Set up state for the hovered and active state + const [hovered, setHover] = useState(false) + const [active, setActive] = useState(false) + // Subscribe this component to the render-loop, rotate the mesh every frame + useFrame((state, delta) => { + if (mesh && mesh.current){ + // @ts-ignore + return mesh.current.rotation.x += delta + } + }) + // Return view, these are regular three.js elements expressed in JSX + return ( + setActive(!active)} + onPointerOver={(event) => setHover(true)} + onPointerOut={(event) => setHover(false)}> + + + + ) +} +export const HeroModel: React.FC = ({}) => { + return ( + + + + + + + ) +} + +// export const HeroModel: React.FC = ({ +// layout = 'floating', +// renderer = '3d', +// modelUrl, +// className, +// children, +// asciiConfig, +// initialX, +// initialY, +// initialZ, +// rotateSpeed = ROTATE_SPEED, +// enableZoom, +// enableRotateOnScroll, +// withParallelEffect, +// ...props +// }) => { + const scrollY = useScrollY() + const initialPosition = useMemo(() => { + if (typeof window === 'undefined') return new THREE.Vector3(0, 0, 0) + if (renderer === 'ascii') { + return new THREE.Vector3( + initialX || random(MIN_X, MAX_X), + initialY || random(MIN_Y, MAX_Y), + 0, + ) + } + // if not ascii then use the max z + return new THREE.Vector3(3.1, initialY || random(MIN_Y, MAX_Y), 0) + }, [initialX, initialY, initialZ, renderer]) +// return ( +//
+
+// +// +// +// +// }> +// +// +// }> + + + + +// +// +// +// +// {!isTouchDevice() && } + {renderer === 'ascii' && ( + + )} +// +// +//
+ +//
+// ) +// } + + */ +export default {} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/index.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/index.tsx index 7da17d1..8e367da 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/index.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroModel/index.tsx @@ -1,17 +1,20 @@ -import BrowserOnly from '@docusaurus/BrowserOnly' import React from 'react' -import { HeroModelProps } from './HeroModel' +import { HeroModel as Model, HeroModelProps } from './HeroModel' export const HeroModel: React.FC = (props) => { - return ( - - {() => { - const { HeroModel: Model } = require('./HeroModel') + if (typeof window === 'undefined') return null - return - }} - - ) + return + + // return ( + // + // {() => { + // const { HeroModel: Model } = require('./HeroModel') + // + // return + // }} + // + // ) } export type { HeroModelProps } from './HeroModel' diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroTitle/HeroTitle.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroTitle/HeroTitle.scss index d38a9df..0e7e830 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/HeroTitle/HeroTitle.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/HeroTitle/HeroTitle.scss @@ -1,3 +1,6 @@ +@use '../../../css/utils'; +@use '../../../css/lsd'; + .mdx-hero-title { font-weight: 300 !important; z-index: -2; @@ -11,3 +14,13 @@ .mdx-hero-title--uppercase { text-transform: uppercase; } + +@include utils.responsive('lg', 'down') { + .mdx-hero-title { + @include lsd.typography('h3'); + } + + .mdx-hero-title--large { + font-size: 1.875rem !important; + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.scss b/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.scss index 49197e3..681d4de 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.scss +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.scss @@ -1,7 +1,11 @@ +@use '../../../css/utils'; +@use '../../../css/lsd'; + .mdx-showcase { - padding-top: 8.25rem; + width: 100%; + overflow: hidden; display: grid; - grid-template-columns: repeat(3, 1fr); + grid-template-columns: repeat(4, 1fr); gap: 1rem; } @@ -25,3 +29,23 @@ margin-top: 24px; padding-top: 16px; } + +@include utils.responsive('lg', 'down') { + .mdx-showcase { + grid-template-columns: repeat(2, 1fr); + gap: 1.5rem 1rem; + } + + .mdx-showcase__item-name { + @include lsd.typography('h6'); + } + + .mdx-showcase__item-description { + margin-top: 1rem; + } + + .mdx-showcase__item-logo { + width: 34px; + height: auto; + } +} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.tsx b/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.tsx index e01708f..00ff5a3 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.tsx +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/Showcase/Showcase.tsx @@ -34,7 +34,7 @@ export const Showcase: React.FC = ({ /> {item.name} diff --git a/packages/logos-docusaurus-theme/src/client/components/mdx/index.ts b/packages/logos-docusaurus-theme/src/client/components/mdx/index.ts index 44f7474..7d0f06c 100644 --- a/packages/logos-docusaurus-theme/src/client/components/mdx/index.ts +++ b/packages/logos-docusaurus-theme/src/client/components/mdx/index.ts @@ -1,10 +1,12 @@ +export * from './Box' +export * from './CallToActionButton' export * from './CallToActionSection' export * from './FeatureList' export * from './Hero' export * from './HeroAction' export * from './HeroActions' export * from './HeroDescription' +export * from './HeroInfo' export * from './HeroModel' export * from './HeroTitle' export * from './Showcase' -export * from './HeroInfo' diff --git a/packages/logos-docusaurus-theme/src/client/css/_lsd.scss b/packages/logos-docusaurus-theme/src/client/css/_lsd.scss index 2e95d5b..bca8e23 100644 --- a/packages/logos-docusaurus-theme/src/client/css/_lsd.scss +++ b/packages/logos-docusaurus-theme/src/client/css/_lsd.scss @@ -1,5 +1,5 @@ @mixin typography($variant) { - font-size: var(--lsd-#{$variant}-fontSize); - line-height: var(--lsd-#{$variant}-lineHeight); - font-family: var(--lsd-typography-generic-font-family); + font-size: var(--lsd-#{$variant}-fontSize) !important; + line-height: var(--lsd-#{$variant}-lineHeight) !important; + font-family: var(--lsd-typography-generic-font-family) !important; } diff --git a/packages/logos-docusaurus-theme/src/client/css/custom.scss b/packages/logos-docusaurus-theme/src/client/css/custom.scss index 29753b4..59341d2 100644 --- a/packages/logos-docusaurus-theme/src/client/css/custom.scss +++ b/packages/logos-docusaurus-theme/src/client/css/custom.scss @@ -708,17 +708,17 @@ a[class^='sidebarLogo_'] { margin-top: 0 !important; margin-bottom: 80px !important; } - & > main { padding: 0; &, > .row, & > .row > .col { + --ifm-spacing-horizontal: var(--content-padding); + width: 100% !important; flex-basis: 100% !important; max-width: unset; - padding: 0; margin: 0; flex: unset; } @@ -996,3 +996,9 @@ a[class^='sidebarLogo_'] { margin-left: unset; } } + +[data-hidden-doc-sidebar='true'] { + .theme-doc-sidebar-container { + display: none; + } +} diff --git a/packages/logos-docusaurus-theme/src/client/lib/makeStyle.ts b/packages/logos-docusaurus-theme/src/client/lib/makeStyle.ts new file mode 100644 index 0000000..2b6d53e --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/lib/makeStyle.ts @@ -0,0 +1,13 @@ +import React from 'react' + +export const makeStyle = ( + style: React.CSSProperties, + vars: Record = {}, +) => + ({ + ...style, + ...Object.entries(vars).reduce( + (value, [name, val]) => ({ ...value, [`--${name}`]: val }), + {}, + ), + } as React.CSSProperties) diff --git a/packages/logos-docusaurus-theme/src/client/lib/ui.utils.ts b/packages/logos-docusaurus-theme/src/client/lib/ui.utils.ts index 5c9a235..b39a78a 100644 --- a/packages/logos-docusaurus-theme/src/client/lib/ui.utils.ts +++ b/packages/logos-docusaurus-theme/src/client/lib/ui.utils.ts @@ -19,3 +19,15 @@ export const isTouchDevice = () => { (navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0) ) } + +export const generateTextShadow = (steps: number): string => { + let shadows = '' + for (let i = 0; i < steps; i++) { + let colorValue = Math.floor((i / (steps - 1)) * 255) // Generate a value between 0 and 255 + let shadow = `${-i * 5}px ${ + -i * 5 + }px 0px rgb(${colorValue}, ${colorValue}, ${colorValue})` + shadows += (i === 0 ? '' : ', ') + shadow + } + return shadows +} diff --git a/packages/logos-docusaurus-theme/src/client/lib/useThemeOptions.ts b/packages/logos-docusaurus-theme/src/client/lib/useThemeOptions.ts new file mode 100644 index 0000000..df9bbcf --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/lib/useThemeOptions.ts @@ -0,0 +1,17 @@ +import { useActivePlugin } from '@docusaurus/plugin-content-docs/lib/client/index.js' +import useDocusaurusContext from '@docusaurus/useDocusaurusContext' +import { DocConfig, ThemeOptions } from '../types/theme.types' + +export const useThemeOptions = (): ThemeOptions => { + const { + siteConfig: { customFields = {} }, + } = useDocusaurusContext() + + return (customFields['logos-docusaurus-theme'] ?? {}) as ThemeOptions +} + +export const useDocThemeOptions = (): DocConfig => { + const activePlugin = useActivePlugin() + const themeOptions = useThemeOptions() + return activePlugin ? themeOptions?.docs?.[activePlugin?.pluginId] ?? {} : {} +} diff --git a/packages/logos-docusaurus-theme/src/client/theme/Navbar/Content/index.tsx b/packages/logos-docusaurus-theme/src/client/theme/Navbar/Content/index.tsx index 071f7c3..ae303e6 100644 --- a/packages/logos-docusaurus-theme/src/client/theme/Navbar/Content/index.tsx +++ b/packages/logos-docusaurus-theme/src/client/theme/Navbar/Content/index.tsx @@ -11,6 +11,7 @@ import NavbarItem from '@theme/NavbarItem' import SearchBar from '@theme/SearchBar' import clsx from 'clsx' import React from 'react' +import { useHydrated } from '../../../lib/useHydrated' import styles from './styles.module.scss' function useNavbarItems() { @@ -42,6 +43,7 @@ ${JSON.stringify(item, null, 2)}`, } export default function NavbarContent() { + const hydrated = useHydrated() const mobileSidebar = useNavbarMobileSidebar() const allItems = useNavbarItems() const [leftItems, rightItems] = splitNavbarItems( @@ -62,13 +64,20 @@ export default function NavbarContent() { - {searchBarItem && } - {!mobileSidebar.disabled && } + {hydrated && ( + + {searchBarItem && } + + )} + + {!mobileSidebar.disabled && } +
diff --git a/packages/logos-docusaurus-theme/src/client/theme/Root.tsx b/packages/logos-docusaurus-theme/src/client/theme/Root.tsx index c2fdb2a..8108e4e 100644 --- a/packages/logos-docusaurus-theme/src/client/theme/Root.tsx +++ b/packages/logos-docusaurus-theme/src/client/theme/Root.tsx @@ -4,10 +4,15 @@ import { useColorMode, } from '@docusaurus/theme-common/internal' import React from 'react' +import { useDocThemeOptions } from '../lib/useThemeOptions' import styles from './style.module.css' const Content = ({ children }) => { const colorMode = useColorMode() + + const options = useDocThemeOptions() + const hideDocSidebar = options?.sidebar?.hide + return ( { : defaultThemes.light } > -
{children}
+
+ {children} +
) } diff --git a/packages/logos-docusaurus-theme/src/client/types/theme.types.ts b/packages/logos-docusaurus-theme/src/client/types/theme.types.ts new file mode 100644 index 0000000..bccac9d --- /dev/null +++ b/packages/logos-docusaurus-theme/src/client/types/theme.types.ts @@ -0,0 +1,9 @@ +export type DocConfig = { + sidebar?: { + hide?: boolean + } +} + +export type ThemeOptions = { + docs?: Record +} diff --git a/packages/logos-docusaurus-theme/src/client/types/ui.types.ts b/packages/logos-docusaurus-theme/src/client/types/ui.types.ts index ad53471..11d64c2 100644 --- a/packages/logos-docusaurus-theme/src/client/types/ui.types.ts +++ b/packages/logos-docusaurus-theme/src/client/types/ui.types.ts @@ -1,3 +1,5 @@ +import { GroupProps } from '@react-three/fiber/dist/declarations/src/three-types' + export enum ECommunityProviders { 'discord' = 'discord', 'twitter' = 'twitter', @@ -8,3 +10,34 @@ export enum ECommunityProviders { 'telegram' = 'telegram', 'gscholar' = 'gscholar', } + +export type LookPresetItemValues = { + cameraPos: [number, number, number] + cameraRot: [number, number, number] + controlsTarget: [number, number, number] +} + +export type LookPresetItem = { + modelId: string + simple: LookPresetItemValues + abstract: LookPresetItemValues +} + +export type MovementProps = { + rotateSpeed?: number + enableZoom?: boolean + enableRotateOnScroll?: boolean + preset: LookPresetItemValues +} & GroupProps + +export type AsciiConfigs = { + characters?: string + invert?: boolean + color?: boolean + bgColor?: string + fgColor?: string + resolution?: number + renderIndex?: number + textShadowSize?: number + withTextShadow?: boolean +} diff --git a/packages/logos-docusaurus-theme/src/index.ts b/packages/logos-docusaurus-theme/src/index.ts index 68e75d8..44d7b85 100644 --- a/packages/logos-docusaurus-theme/src/index.ts +++ b/packages/logos-docusaurus-theme/src/index.ts @@ -1,6 +1,10 @@ -import type { PluginOptions } from '@docusaurus/theme-classic' +import type { PluginOptions as DefaultPluginOptions } from '@docusaurus/theme-classic' import type { LoadContext, Plugin } from '@docusaurus/types' +import _ from 'lodash' import path from 'path' +import type { ThemeOptions } from './client/types/theme.types' + +export type PluginOptions = DefaultPluginOptions & ThemeOptions export default function logosTheme( context: LoadContext, @@ -9,13 +13,24 @@ export default function logosTheme( const clientModules: string[] = [ path.resolve(__dirname, './client/css/custom.scss'), ] - if (options.customCss) { if (typeof options.customCss === 'string') clientModules.push(options.customCss) else clientModules.push(...options.customCss) } + context.siteConfig.customFields = { + ...(context.siteConfig.customFields ?? {}), + 'logos-docusaurus-theme': { + ...options, + ...(_.get( + context, + 'siteConfig.customFields.logos-docusaurus-theme', + {}, + ) as object), + }, + } + return { name: 'logos-docusaurus-theme', @@ -27,5 +42,3 @@ export default function logosTheme( getClientModules: () => clientModules, } } - -export { PluginOptions } diff --git a/yarn.lock b/yarn.lock index 022201d..b9ccea1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,64 @@ # yarn lockfile v1 +"@acid-info/logos-docusaurus-preset@^1.0.0-alpha.4": + version "1.0.0-alpha.4" + resolved "https://registry.yarnpkg.com/@acid-info/logos-docusaurus-preset/-/logos-docusaurus-preset-1.0.0-alpha.4.tgz#ec958cc49d0420bc361541002138dc0bd8595889" + integrity sha512-kVOaa0bCPy5tBJxEZS51N3+UgtO6M4TciRA7x/4JQ+uwy1s5cSldkecmjmb1Ch5/tGB6QCllU2tjuZrsY1aiRg== + dependencies: + "@acid-info/logos-docusaurus-search-local" "^1.0.0-alpha.0" + "@acid-info/logos-docusaurus-theme" "^1.0.0-alpha.4" + "@docusaurus/core" "^2.4.1" + "@docusaurus/module-type-aliases" "^2.4.1" + "@docusaurus/preset-classic" "^2.4.1" + "@docusaurus/types" "^2.4.1" + "@docusaurus/utils" "^2.4.1" + "@docusaurus/utils-common" "^2.4.1" + "@docusaurus/utils-validation" "^2.4.1" + docusaurus-plugin-sass "^0.2.3" + fs-extra "^10.1.0" + lodash "^4.17.21" + +"@acid-info/logos-docusaurus-theme@^1.0.0-alpha.4": + version "1.0.0-alpha.4" + resolved "https://registry.yarnpkg.com/@acid-info/logos-docusaurus-theme/-/logos-docusaurus-theme-1.0.0-alpha.4.tgz#63ef02dc4f9acc816bc9bdb7fb5a4664c0a5a3ee" + integrity sha512-mQBaIUVVe2LWnKHFfeCnMtLkbCbJxe306DrO+Q2v4f4VXkDiTygXDCd8Rs/DFCPhlyIDRkZRfgH4Fzmb1S+lwA== + dependencies: + "@acid-info/logos-docusaurus-preset" "^1.0.0-alpha.4" + "@acid-info/lsd-react" "^0.1.0-alpha.8" + "@docusaurus/core" "^2.4.1" + "@docusaurus/mdx-loader" "^2.4.1" + "@docusaurus/module-type-aliases" "^2.4.1" + "@docusaurus/plugin-content-blog" "^2.4.1" + "@docusaurus/plugin-content-docs" "^2.4.1" + "@docusaurus/plugin-content-pages" "^2.4.1" + "@docusaurus/theme-classic" "^2.4.1" + "@docusaurus/theme-common" "^2.4.1" + "@docusaurus/theme-translations" "^2.4.1" + "@docusaurus/types" "^2.4.1" + "@docusaurus/utils" "^2.4.1" + "@docusaurus/utils-common" "^2.4.1" + "@docusaurus/utils-validation" "^2.4.1" + "@emotion/react" "^11.11.0" + "@emotion/styled" "^11.11.0" + "@mdx-js/react" "^1.6.22" + "@react-three/drei" "8.20.2" + "@react-three/fiber" "6.2.3" + "@tryghost/content-api" "^1.11.4" + clsx "^1.2.1" + copy-text-to-clipboard "^3.0.1" + copy-to-clipboard "^3.3.2" + docusaurus-plugin-sass "^0.2.3" + dotenv "^16.0.3" + lodash "^4.17.21" + prism-react-renderer "^1.3.5" + react "^17.0.2" + react-dom "^17.0.2" + react-use "^17.4.0" + three "^0.152.2" + three-stdlib "^2.23.4" + utility-types "^3.10.0" + "@acid-info/lsd-react@^0.1.0-alpha.8": version "0.1.0-alpha.8" resolved "https://registry.yarnpkg.com/@acid-info/lsd-react/-/lsd-react-0.1.0-alpha.8.tgz#f34392cd928c5bf08f325f923e88853bc809c4be"