🔧 chore: Enable ssr

This commit is contained in:
canisminor1990
2024-11-24 22:29:33 +08:00
parent 10d498ea9d
commit 721740aa68
6 changed files with 39 additions and 30 deletions
+6 -1
View File
@@ -21,6 +21,7 @@ const nav: INavItem[] = [
const themeConfig: SiteThemeConfig = {
actions: [
{
icon: 'Github',
link: homepage,
openExternal: true,
text: 'GitHub',
@@ -39,7 +40,7 @@ const themeConfig: SiteThemeConfig = {
},
apiHeader: {
docUrl: `{github}/tree/master/src/{atomId}/index.md`,
match: ['/components', '/mdx'],
match: ['/components', '/brand', '/mdx'],
pkg: name,
sourceUrl: `{github}/tree/master/src/{atomId}/index.tsx`,
},
@@ -50,6 +51,7 @@ const themeConfig: SiteThemeConfig = {
repo: 'lobehub/lobe-ui',
repoId: 'R_kgDOJloKoA',
},
lastUpdated: true,
metadata: {
openGraph: {
image:
@@ -79,8 +81,10 @@ export default defineConfig({
define: {
'process.env': process.env,
},
exportStatic: {},
extraBabelPlugins: ['babel-plugin-antd-style'],
favicons: ['https://lobehub.com/favicon.ico'],
jsMinifier: 'swc',
locales: [{ id: 'en-US', name: 'English' }],
mfsu: isWin ? undefined : {},
npmClient: 'pnpm',
@@ -93,6 +97,7 @@ export default defineConfig({
sitemap: {
hostname: 'https://ui.lobehub.com',
},
ssr: isProduction ? {} : false,
styles: [
`html, body { background: transparent; }
+2 -1
View File
@@ -43,4 +43,5 @@ test-output
# misc
# add other ignore file below
bun.lockb
*.patch
*.patch
./server
+2 -2
View File
@@ -39,7 +39,7 @@ export default () => {
<Center>
<h2 style={{ fontSize: 20 }}>🤯 Start building your AIGC app now</h2>
<Snippet language={'bash'}>{'$ bun add @lobehub/ui'}</Snippet>
<div style={{ color: theme.colorTextDescription, textAlign: 'center' }}>
<p style={{ color: theme.colorTextSecondary, textAlign: 'center' }}>
The Lobe UI components are developed based on{' '}
<a href={'https://ant.design/components/overview'} rel="noreferrer" target={'_blank'}>
Antd components
@@ -50,7 +50,7 @@ export default () => {
antd-style
</a>{' '}
as the default css-in-js styling solution.
</div>
</p>
</Center>
<Highlighter language={'tsx'} style={{ width: '100%' }} type={'ghost'}>
{example}
+2 -1
View File
@@ -35,6 +35,7 @@
"build:watch": "father dev",
"ci": "npm run lint:circular && npm run lint && npm run type-check",
"clean": "rm -r es lib dist coverage .dumi/tmp .eslintcache node_modules/.cache",
"dev": "dumi dev",
"docs:build": "dumi build",
"docs:build-analyze": "ANALYZE=1 dumi build",
"docs:dev": "dumi dev",
@@ -145,7 +146,7 @@
"cross-env": "^7.0.3",
"dpdm": "^3.14.0",
"dumi": "^2.4.14",
"dumi-theme-lobehub": "^1.9.1",
"dumi-theme-lobehub": "^1.10.4",
"eslint": "^8.57.1",
"father": "^4.5.1",
"husky": "^9.1.7",
+5
View File
@@ -0,0 +1,5 @@
User-Agent: *
Allow: /
Host: https://ui.lobehub.com
Sitemap: https://ui.lobehub.com/sitemap.xml
+22 -25
View File
@@ -2,10 +2,12 @@
import { Button, ConfigProvider } from 'antd';
import { useResponsive } from 'antd-style';
import * as LucideIcon from 'lucide-react';
import { Link } from 'dumi';
import { Github } from 'lucide-react';
import { memo, useCallback } from 'react';
import { Center, Flexbox } from 'react-layout-kit';
import A from '@/A';
import AuroraBackground from '@/AuroraBackground';
import GradientButton from '@/GradientButton';
import Icon from '@/Icon';
@@ -63,36 +65,31 @@ const Hero = memo<HeroProps>(({ title, description, actions }) => {
<Flexbox className={styles.actions} gap={24} horizontal justify={'center'}>
{actions!.map(({ text, link, openExternal, icon, type }, index) => {
// @ts-ignore
const ButtonIcon = icon && LucideIcon[icon];
const ButtonIcon = icon === 'Github' ? <Icon icon={Github} /> : icon;
const content =
type === 'primary' ? (
<GradientButton block={mobile} icon={ButtonIcon} key={index} size="large">
{text}
</GradientButton>
) : (
<Button block={mobile} icon={ButtonIcon} key={index} size="large" type="primary">
{text}
</Button>
);
return (
<a
return openExternal ? (
<A
href={link}
key={text}
rel="noreferrer"
target={openExternal ? '_blank' : undefined}
>
{type === 'primary' ? (
<GradientButton
block={mobile}
icon={ButtonIcon && <Icon icon={ButtonIcon} />}
key={index}
size="large"
>
{text}
</GradientButton>
) : (
<Button
block={mobile}
icon={ButtonIcon && <Icon icon={ButtonIcon} />}
key={index}
size="large"
type="primary"
>
{text}
</Button>
)}
</a>
{content}
</A>
) : (
<Link key={text} to={link}>
{content}
</Link>
);
})}
</Flexbox>