Skip to content

Commit

Permalink
docs: build storybook in addition to yarn build with Vercel (#817)
Browse files Browse the repository at this point in the history
* docs(.storybook): fix Inter font in `storybook`

* chore(.gitignore): ignore `yarn storybook:build` output

* docs(app/components/navbar): add Button to visit `storybook`

* ci(.github/workflows/storybook): create workflow to always merge `main` -> `storybook` branch

The `storybook` branch will now be a permanent fixture alongside `main`. Its purpose is to deploy to
a separate URL on Vercel so we can host the docs and `storybook` output simultaneously, since
`next.js` cannot deploy static HTML found in `storybook` output.
  • Loading branch information
tulup-conner authored Jun 22, 2023
1 parent 7461173 commit e521b3e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 54 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/build.yaml

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'CodeQL'
name: CodeQL

on:
push:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy Storybook

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v2.3.1

- name: 🚀 Merge main -> storybook
uses: devmasx/merge-branch@1.4.0
with:
type: now
from_branch: main
target_branch: storybook
github_token: ${{ github.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cypress/screenshots
cypress/videos
lib
node_modules
storybook-static
.DS_Store
npm-debug.log*
tsconfig.tsbuildinfo
Expand Down
Binary file added .storybook/inter.woff2
Binary file not shown.
6 changes: 5 additions & 1 deletion .storybook/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
@layer base {
@font-face {
font-family: 'Inter';
src: url(/public/inter.woff2) format('woff2');
src: url(inter.woff2) format('woff2');
font-weight: 100 200 300 400 500 600 700 800 900;
font-display: swap;
}

html {
font-family: 'Inter', sans-serif;
}
}
9 changes: 9 additions & 0 deletions app/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link';
import type { FC } from 'react';
import { BsGithub } from 'react-icons/bs';
import { SiStorybook } from 'react-icons/si';
import { Badge, DarkThemeToggle, Tooltip } from '~/src';
import pkg from './../../package.json' assert { type: 'json' };

Expand Down Expand Up @@ -57,6 +58,14 @@ export const NavbarIcons: FC = () => {
const version = pkg?.version ?? 'latest';
return (
<div className="flex items-center gap-1">
<a
href="https://flowbite-react-git-storybook-themesberg.vercel.app"
className="hidden rounded-lg p-2.5 text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:ring-gray-700 lg:block"
>
<Tooltip animation={false} content="View Storybook">
<SiStorybook aria-hidden className="h-5 w-5" />
</Tooltip>
</a>
<a
href="https://github.com/themesberg/flowbite-react"
className="hidden rounded-lg p-2.5 text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:ring-gray-700 lg:block"
Expand Down

1 comment on commit e521b3e

@vercel
Copy link

@vercel vercel bot commented on e521b3e Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.