Compare commits

...

12 Commits

Author SHA1 Message Date
Matthew Wang
8ebca95cdd Merge branch 'main' into add-chromatic 2023-08-30 10:28:05 -07:00
Matt Wang
4556629454 Update .gitignore (#1327)
This PR moves over the changes from https://github.com/just-the-docs/just-the-docs/pull/1112, namely making the `.gitignore` more descriptive and bringing it to parity with the recommendations from Jekyll.

---------

Co-authored-by: Peter Mosses <18308236+pdmosses@users.noreply.github.com>
2023-08-30 10:22:08 -07:00
Matthew Wang
bebaee046a Update CHANGELOG.md 2023-08-30 10:14:43 -07:00
Michael Flanakin
c115932255 Fix Windows emoji font fallback (#1337) 2023-08-30 10:13:18 -07:00
dependabot[bot]
5deba46197 Bump prettier from 3.0.2 to 3.0.3 (#1338)
Bumps [prettier](https://github.com/prettier/prettier) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-30 09:43:03 -07:00
Matthew Wang
720dd430d7 Update outdated ruby workflow 2023-08-26 13:41:08 -04:00
Matthew Wang
3c816ce3de Temporary change to trigger storybook diff 2023-04-24 15:05:44 -07:00
Matthew Wang
4ddb5ef460 Use chromatic action instead 2023-04-24 14:52:03 -07:00
Matthew Wang
bd2d1dc046 Bump action 2023-04-24 14:48:31 -07:00
Matthew Wang
90b9c0cce0 Add action 2023-04-24 14:44:58 -07:00
Matthew Wang
f55f648479 Install chromatic 2023-04-24 13:40:46 -07:00
Matthew Wang
7e6bbb9e6a First draft: add chromatic/storybook 2023-04-24 13:20:58 -07:00
18 changed files with 23322 additions and 660 deletions

15
.babelrc.json Normal file
View File

@@ -0,0 +1,15 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100
}
}
],
"@babel/preset-typescript"
],
"plugins": []
}

51
.github/workflows/chromatic.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
on:
push:
branches:
- main
pull_request:
branches:
- main
name: 'Chromatic'
jobs:
chromatic:
name: "Chromatic"
strategy:
matrix:
jekyll-version: [4.3]
os: [ ubuntu-latest ]
ruby-version: [3.1]
node-version: [18.x]
runs-on: ${{ matrix.os }}
steps:
# Ruby setup
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: false
- name: Bundle Install
run: bundle install
- name: Install Jekyll ${{ matrix.jekyll-version }}
run: gem install jekyll -v ${{ matrix.jekyll-version }}
- name: Init Search
run: bundle exec rake search:init
- name: Build Site
run: bundle exec jekyll build
# Node setup
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build-storybook
- name: Publish to Chromatic
uses: chromaui/action@v1
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

View File

@@ -10,8 +10,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 3.2
uses: actions/setup-ruby@v1
- name: Setup Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"

35
.gitignore vendored
View File

@@ -1,8 +1,33 @@
# Not sure what a .gitignore is?
# See: https://git-scm.com/docs/gitignore
# The first files are directly copied from Jekyll's first-party docs on `.gitignore` files:
# https://jekyllrb.com/tutorials/using-jekyll-with-bundler/#commit-to-source-control
# Ignore the default location of the built site, and caches and metadata generated by Jekyll
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata
# Ignore folders generated by Bundler
.bundle/
vendor/
# These next files are used by Just the Docs developers. They are not necessary for end users of the theme, only developers.
# We use Stylelint and Prettier, JavaScript tools, to lint and format our own code,
# We use Node.js as our runtime, so we ignore node_modules
node_modules
# We also use Storybook to test regressions in changes; we ignore the build output.
storybook-static
# .DS_Store is a macOS-only metadata file about directories. Convention is to not commit them.
# See: https://en.wikipedia.org/wiki/.DS_Store
.DS_Store
# These are legacy globs that typically target Ruby theme developers. We may change these at a later date.
*.gem
.bundle
.ruby-version
.jekyll-cache
.sass-cache
_site
node_modules
.DS_Store

17
.storybook/main.js Normal file
View File

@@ -0,0 +1,17 @@
/** @type { import('@storybook/html-webpack5').StorybookConfig } */
const config = {
stories: ["../stories/**/*.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/html-webpack5",
options: {},
},
docs: {
autodocs: "tag",
},
}
export default config

14
.storybook/preview.js Normal file
View File

@@ -0,0 +1,14 @@
/** @type { import('@storybook/html').Preview } */
const preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
}
export default preview

View File

@@ -17,7 +17,15 @@ This website is built from the `HEAD` of the `main` branch of the theme reposito
Code changes to `main` that are *not* in the latest release:
- N/A
- Fixed: Windows emoji font fallback by [@flanakin] in [#1337]
[#1337]: https://github.com/just-the-docs/just-the-docs/pull/1337
### New Contributors
- [@flanakin] made their first contribution in [#1337]
[@flanakin]: https://github.com/flanakin
## Release v0.6.1

View File

@@ -48,6 +48,7 @@ exclude:
- Dockerfile
# theme test code
- fixtures/
- stories/
# Set a path/url to a logo that will be displayed instead of the title
#logo: "/assets/images/just-the-docs.png"

View File

@@ -105,7 +105,7 @@
}
.btn-purple {
@include btn-color($white, $purple-100);
@include btn-color($white, $purple-300);
}
.btn-blue {

View File

@@ -2,7 +2,7 @@
// prettier-ignore
$body-font-family: system-ui, -apple-system, blinkmacsystemfont, "Segoe UI",
roboto, "Helvetica Neue", arial, sans-serif !default;
roboto, "Helvetica Neue", arial, sans-serif, "Segoe UI Emoji" !default;
$mono-font-family: "SFMono-Regular", menlo, consolas, monospace !default;
$root-font-size: 16px !default; // DEPRECATED: previously base font-size for rems
$body-line-height: 1.4 !default;

View File

@@ -21,7 +21,7 @@ nav_order: 1
By default, Just the Docs uses a native system font stack for sans-serif fonts:
```scss
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Segoe UI Emoji"
```
ABCDEFGHIJKLMNOPQRSTUVWXYZ

23630
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,31 @@
{
"name": "just-the-docs",
"version": "0.3.3",
"version": "0.5.0",
"description": "A modern Jekyll theme for documentation",
"repository": "just-the-docs/just-the-docs",
"repository": {
"type": "git",
"url": "git+https://github.com/just-the-docs/just-the-docs.git"
},
"license": "MIT",
"bugs": "https://github.com/just-the-docs/just-the-docs/issues",
"bugs": {
"url": "https://github.com/just-the-docs/just-the-docs/issues"
},
"devDependencies": {
"@babel/preset-env": "^7.21.4",
"@babel/preset-typescript": "^7.21.4",
"@storybook/addon-essentials": "^7.0.7",
"@storybook/addon-interactions": "^7.0.7",
"@storybook/addon-links": "^7.0.7",
"@storybook/blocks": "^7.0.7",
"@storybook/html": "^7.0.7",
"@storybook/html-webpack5": "^7.0.7",
"@storybook/testing-library": "^0.0.14-next.2",
"chromatic": "^6.17.3",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.2",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.0.7",
"stylelint": "^15.10.3",
"stylelint-config-standard-scss": "^10.0.0"
},
@@ -16,7 +34,10 @@
"lint:css": "stylelint '**/*.scss'",
"lint:formatting": "prettier --check '**/*.{scss,js,json}'",
"format": "prettier --write '**/*.{scss,js,json}'",
"test": "npm run lint"
"test": "npm run lint",
"storybook": "bundle exec jekyll build && storybook dev -p 6006",
"build-storybook": "bundle exec jekyll build && storybook build",
"chromatic": "npx chromatic --project-token=9355f489c51b -d storybook-static"
},
"stylelint": {
"ignoreFiles": [
@@ -43,5 +64,7 @@
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}
},
"homepage": "https://just-the-docs.com",
"_id": "just-the-docs@0.5.0"
}

7
stories/Introduction.mdx Normal file
View File

@@ -0,0 +1,7 @@
import { Meta } from '@storybook/blocks';
<Meta title="Example/Introduction" />
# Storybook for Just the Docs
A WIP [Storybook](https://storybook.js.org/) for Just the Docs.

View File

@@ -0,0 +1,11 @@
import "../../_site/assets/css/just-the-docs-default.css"
export const createButton = ({ variant = "default", label, size = "4" }) => {
const btn = document.createElement("button")
btn.type = "button"
btn.innerText = label
btn.className = ["btn", `btn-${variant}`, `fs-${size}`].join(" ")
return btn
}

View File

@@ -0,0 +1,68 @@
import { createButton } from "./Button"
export default {
title: "UI Components/Button",
tags: ["autodocs"],
render: ({ label, ...args }) => {
return createButton({ label, ...args })
},
argTypes: {
label: { control: "text" },
size: {
control: { type: "select" },
options: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
},
variant: {
control: { type: "select" },
options: ["default", "primary", "purple", "blue", "green", "outline"],
},
},
}
export const Default = {
args: {
variant: "default",
label: "Button",
size: 4,
},
}
export const Primary = {
args: {
variant: "primary",
label: "Button",
size: 4,
},
}
export const Purple = {
args: {
variant: "purple",
label: "Button",
size: 4,
},
}
export const Blue = {
args: {
variant: "blue",
label: "Button",
size: 4,
},
}
export const Green = {
args: {
variant: "green",
label: "Button",
size: 4,
},
}
export const Outline = {
args: {
variant: "outline",
label: "Button",
size: 4,
},
}

View File

@@ -0,0 +1,10 @@
import "../../_site/assets/css/just-the-docs-default.css"
export const createLabel = ({ variant = "default", label, size = "4" }) => {
const btn = document.createElement("span")
btn.innerText = label
btn.className = ["label", `label-${variant}`, `fs-${size}`].join(" ")
return btn
}

View File

@@ -0,0 +1,68 @@
import { createLabel } from "./Label"
export default {
title: "UI Components/Label",
tags: ["autodocs"],
render: ({ label, ...args }) => {
return createLabel({ label, ...args })
},
argTypes: {
label: { control: "text" },
size: {
control: { type: "select" },
options: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
},
variant: {
control: { type: "select" },
options: ["default", "purple", "blue", "green", "red", "yellow"],
},
},
}
export const Default = {
args: {
variant: "default",
label: "Label",
size: 4,
},
}
export const Purple = {
args: {
variant: "purple",
label: "Label",
size: 4,
},
}
export const Blue = {
args: {
variant: "blue",
label: "Label",
size: 4,
},
}
export const Green = {
args: {
variant: "green",
label: "Label",
size: 4,
},
}
export const Red = {
args: {
variant: "red",
label: "Label",
size: 4,
},
}
export const Yellow = {
args: {
variant: "yellow",
label: "Label",
size: 4,
},
}