Skip to content

Commit

Permalink
feat(www): scaffold side homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
noahluftyang committed Jan 22, 2025
1 parent fba28cc commit c6febcf
Show file tree
Hide file tree
Showing 21 changed files with 13,629 additions and 3,402 deletions.
16,282 changes: 12,880 additions & 3,402 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
packages:
- .templates/*
- packages/*
- www

catalog:
'@storybook/addon-essentials': ^8.4.5
Expand Down
41 changes: 41 additions & 0 deletions www/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
18 changes: 18 additions & 0 deletions www/docs/components/avatar.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Avatar

## Setup

```sh
npm install @sipe-team/avatar
```

## Usage

```tsx
import { Avatar } from '@sipe-team/avatar';
```

```tsx
<Avatar size="md" src="https://randomuser.me/api/portraits/men/1.jpg" />
```

94 changes: 94 additions & 0 deletions www/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import type * as Preset from '@docusaurus/preset-classic';
import type { Config } from '@docusaurus/types';
import { themes as prismThemes } from 'prism-react-renderer';

export default {
title: 'Side',
tagline: 'Sipe Design System',
favicon: 'img/favicon.ico',
url: 'https://sipe.team',
baseUrl: '/',
organizationName: 'sipe-team',
projectName: '3-2_side',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars.ts',
editUrl: 'https://github.com/sipe-team/3-2_side/tree/main/www/',
},
blog: false,
theme: {
customCss: './src/custom.css',
},
} satisfies Preset.Options,
],
],

themeConfig: {
image: 'img/docusaurus-social-card.jpg',
navbar: {
title: 'Side',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'docSidebar',
label: 'Component',
sidebarId: 'component',
position: 'left',
},
{
href: 'https://github.com/sipe-team/3-2_side',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/docs/intro',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
{
label: 'X',
href: 'https://x.com/docusaurus',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Sipe Team, Inc. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
} satisfies Preset.ThemeConfig,
} satisfies Config;
39 changes: 39 additions & 0 deletions www/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "docs",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "3.7.0",
"@docusaurus/preset-classic": "3.7.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.7.0",
"@docusaurus/tsconfig": "3.7.0",
"@docusaurus/types": "3.7.0",
"typescript": "~5.6.2"
},
"browserslist": {
"production": [">0.5%", "not dead", "not op_mini all"],
"development": [
"last 3 chrome version",
"last 3 firefox version",
"last 5 safari version"
]
}
}
5 changes: 5 additions & 0 deletions www/sidebars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';

export default {
component: [{ type: 'autogenerated', dirName: 'components' }],
} satisfies SidebarsConfig;
11 changes: 11 additions & 0 deletions www/src/HomepageFeatures/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.features {
display: flex;
align-items: center;
padding: 2rem 0;
width: 100%;
}

.featureSvg {
height: 200px;
width: 200px;
}
66 changes: 66 additions & 0 deletions www/src/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import Mountain from '@site/static/img/undraw_docusaurus_mountain.svg';
import React from '@site/static/img/undraw_docusaurus_react.svg';
import Tree from '@site/static/img/undraw_docusaurus_tree.svg';
import Heading from '@theme/Heading';
import clsx from 'clsx';
import type { ComponentProps, ComponentType, ReactNode } from 'react';
import styles from './index.module.css';

type FeatureItem = {
title: string;
Svg: ComponentType<ComponentProps<'svg'>>;
description: ReactNode;
};

const FeatureList: FeatureItem[] = [
{
title: 'Easy to Use',
Svg: Mountain,
description:
'Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly.',
},
{
title: 'Focus on What Matters',
Svg: Tree,
description: (
<>
Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
ahead and move your docs into the <code>docs</code> directory.
</>
),
},
{
title: 'Powered by React',
Svg: React,
description:
'Extend or customize your website layout by reusing React. Docusaurus can be extended while reusing the same header and footer.',
},
];

function Feature({ title, Svg, description }: FeatureItem) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">
<Svg className={styles.featureSvg} role="img" />
</div>
<div className="text--center padding-horiz--md">
<Heading as="h3">{title}</Heading>
<p>{description}</p>
</div>
</div>
);
}

export default function HomepageFeatures(): ReactNode {
return (
<section className={styles.features}>
<div className="container">
<div className="row">
{FeatureList.map((props) => (
<Feature key={props.title} {...props} />
))}
</div>
</div>
</section>
);
}
22 changes: 22 additions & 0 deletions www/src/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:root {
--ifm-color-primary: #2e8555;
--ifm-color-primary-dark: #29784c;
--ifm-color-primary-darker: #277148;
--ifm-color-primary-darkest: #205d3b;
--ifm-color-primary-light: #33925d;
--ifm-color-primary-lighter: #359962;
--ifm-color-primary-lightest: #3cad6e;
--ifm-code-font-size: 95%;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
--ifm-color-primary: #25c2a0;
--ifm-color-primary-dark: #21af90;
--ifm-color-primary-darker: #1fa588;
--ifm-color-primary-darkest: #1a8870;
--ifm-color-primary-light: #29d5b0;
--ifm-color-primary-lighter: #32d8b4;
--ifm-color-primary-lightest: #4fddbf;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
18 changes: 18 additions & 0 deletions www/src/pages/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.heroBanner {
padding: 4rem 0;
text-align: center;
position: relative;
overflow: hidden;
}

@media screen and (max-width: 996px) {
.heroBanner {
padding: 2rem;
}
}

.buttons {
display: flex;
align-items: center;
justify-content: center;
}
46 changes: 46 additions & 0 deletions www/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import HomepageFeatures from '@site/src/HomepageFeatures';
import Heading from '@theme/Heading';
import Layout from '@theme/Layout';
import clsx from 'clsx';
import styles from './index.module.css';

export default function Home() {
const { siteConfig } = useDocusaurusContext();

return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />"
>
<HomepageHeader />
<main>
<HomepageFeatures />
</main>
</Layout>
);
}

function HomepageHeader() {
const { siteConfig } = useDocusaurusContext();

return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<Heading as="h1" className="hero__title">
{siteConfig.title}
</Heading>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/intro"
>
Docusaurus Tutorial - 5min ⏱️
</Link>
</div>
</div>
</header>
);
}
Empty file added www/static/.nojekyll
Empty file.
Binary file added www/static/img/docusaurus-social-card.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/static/img/docusaurus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/static/img/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions www/static/img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c6febcf

Please sign in to comment.