-
Notifications
You must be signed in to change notification settings - Fork 48
ドキュメントサイトに最低限の文章と画像を追加 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
1d590e0
66aebb1
da6376a
af11670
7f36967
4fffad2
47c5e65
94d7835
9ac9a0a
0de02f7
98946e4
a4e2d59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,12 @@ | ||||||||
|  | ||||||||
|
|
||||||||
| # Charcoal | ||||||||
|
|
||||||||
| > Utility-first & layered design system | ||||||||
| > Design system library by pixiv | ||||||||
| - ☑ Supports both CSS-in-JS and CSS | ||||||||
| - ☑ Optimized for gradual adoption | ||||||||
| - ☑ Helps you write your components | ||||||||
| - ユーティリティファーストな設計 | ||||||||
| - CSS-in-JS と CSS 両方で使える | ||||||||
| - 既存のプロジェクトに導入がしやすい | ||||||||
|
Comment on lines
+5
to
+7
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. キャッチフレーズ変更のタイミングでここを決めるので、今は一旦消す
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OKです! |
||||||||
|
|
||||||||
| [Get Started](#docsify) | ||||||||
| [GitHub](https://github.com/pixiv/charcoal/) | ||||||||
| [Get Started](#main) | ||||||||
|
|
||||||||
|  | ||||||||
|  | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,25 @@ | ||
| - はじめに | ||
|
|
||
| - [ライブラリを選択する](pages/choose.md) | ||
|
|
||
| - 定数集 | ||
| - 定数 | ||
|
|
||
| - [🏛 @charcoal/foundation](pages/constants/foundation.md) | ||
| - [🎨 @charcoal/theme](pages/constants/theme.md) | ||
| - [🖌️ @charcoal/pixiv-theme](pages/constants/pixiv-theme.md) | ||
|
|
||
| - ユーテリティ | ||
|
|
||
| - [❓ ユーティリティとはなにか?](pages/utilities/what.md) | ||
| - [💅 @charcoal/styled](pages/utilities/styled.md) | ||
| - [🍃 @charcoal/tailwind](pages/utilities/tailwind.md) | ||
| - [🍃 @charcoal/tailwind-config](pages/utilities/tailwind-config.md) | ||
|
|
||
| - コンポーネント | ||
|
|
||
| - [⚛️ @charcoal/react](pages/components/react.md) | ||
| - [⏳ @charcoal/react-sandbox](pages/components/react-sandbox.md) | ||
| - [⭐ @charcoal/icons](pages/components/icons.md) | ||
|
|
||
| - [コントリビュートしたい方へ](pages/contribution.md) | ||
| - [Changelog](pages/changelog.md) | ||
| - その他 | ||
|
|
||
| - [♻️ @charcoal/icons-cli](pages/misc/icons-cli.md) | ||
| - [👀 @charcoal/tailwind-diff-cli](pages/misc/tailwind-diff-cli.md) | ||
| - [🔨 @charcoal/utils](pages/misc/utils.md) | ||
|
|
||
| - [Storybook](https://pixiv.github.io/charcoal) | ||
| - [Changelogs](https://github.com/pixiv/charcoal/releases) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,27 @@ | ||
| # `@pixiv-elements/icons` | ||
| # `@charcoal/icons` | ||
|
|
||
| ピクシブのすべてのプロダクトで利用可能なアイコンライブラリです。中身 | ||
| は[Custom Element](https://developer.mozilla.org/ja/docs/Web/Web_Components/Using_custom_elements)と | ||
| して実装されています。 | ||
| SVG アイコンを [Custom Elements](https://developer.mozilla.org/ja/docs/Web/Web_Components/Using_custom_elements)として利用できるライブラリです。 | ||
|
|
||
| ### インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i --save-dev @charcoal/icons | ||
| ``` | ||
| $ yarn add @pixiv-elements/icons | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add -D @charcoal/icons | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. icons は devDependencies 推奨ではなさそう |
||
| ``` | ||
|
|
||
| ### 使い方 | ||
|
|
||
| アプリケーションのエントリポイントで `import` します。 Storybook の場合は `preview.(js|ts)` に書くと | ||
| 良いでしょう。 | ||
| アプリケーションのエントリポイントで `import` します。 Storybook の場合は `preview.(js|ts)` に書くと良いでしょう。 | ||
|
|
||
| ```ts | ||
| import '@pixiv-elements/icons' | ||
| import '@charcoal/icons' | ||
| ``` | ||
|
|
||
| これだけで、 `<pixiv-icon>` という HTML タグが利用可能になります。 | ||
|
|
@@ -46,7 +51,7 @@ TypeScript 環境下では、`KnownIconType` という型を拡張すること | |
| くようになります。 | ||
|
|
||
| ```ts | ||
| import PixivIcon from '@pixiv-elements/icons' | ||
| import PixivIcon from '@charcoal/icons' | ||
| import NewFeature from './NewFeature.svg' | ||
|
|
||
| PixivIcon.extend({ | ||
|
|
@@ -55,7 +60,7 @@ PixivIcon.extend({ | |
| '32/NewFeature': NewFeature, | ||
| }) | ||
|
|
||
| declare module '@pixiv-elements/icons' { | ||
| declare module '@charcoal/icons' { | ||
| export interface KnownIconType { | ||
| '16/NewFeature': unknown | ||
| '24/NewFeature': unknown | ||
|
|
@@ -70,11 +75,10 @@ Custom Element は **`className` という props を受け取ることが通常 | |
|
|
||
| https://ja.reactjs.org/docs/web-components.html#using-web-components-in-react | ||
|
|
||
| もし `styled-components` などを使っていて `className` を渡せないと困るケースでは、ラッパーコンポーネ | ||
| ントを作ってください。 | ||
| もし `styled-components` などを使っていて `className` を渡せないと困るケースでは、ラッパーコンポーネントを作ってください。 | ||
|
|
||
| ```tsx | ||
| import { Props as IconProps } from '@pixiv-elements/icons' | ||
| import { Props as IconProps } from '@charcoal/icons' | ||
|
|
||
| interface Props extends Omit<IconProps, 'class'> { | ||
| className?: string | ||
|
|
@@ -84,3 +88,7 @@ export const Icon: React.FC<Props> = ({ className, ...props }) => ( | |
| <pixiv-icon class={className} {...props} /> | ||
| ) | ||
| ``` | ||
|
|
||
| ### 収録アイコン | ||
|
|
||
| [Storybook](https://pixiv.github.io/charcoal?path=/story/icons-pixivicon-pixiv-icon--default) をご覧ください | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # `@charcoal/react-sandbox` | ||
|
|
||
| charcoal デザインシステムに則った React コンポーネントを試験的に公開しているパッケージです。 | ||
|
|
||
| `@charcoal/react` と比較して破壊的な変更が頻繁に行われる可能性があります。 | ||
|
|
||
| ## インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i @charcoal/react-sandbox | ||
| ``` | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add @charcoal/react-sandbox | ||
| ``` | ||
|
|
||
| ## コンポーネント | ||
|
|
||
| [Storybook](https://pixiv.github.io/charcoal) をご覧ください |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # `@charcoal/react` | ||
|
|
||
| charcoal デザインシステムに則った React コンポーネントを提供します。 | ||
|
|
||
| ## インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i @charcoal/react | ||
| ``` | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add @charcoal/react | ||
| ``` | ||
|
|
||
| ## コンポーネント | ||
|
|
||
| [Storybook](https://pixiv.github.io/charcoal) をご覧ください |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # `@charcoal/foundation` | ||
|
|
||
| charcoal デザインシステムで利用されるプリミティブな型定義や値を提供します。 | ||
|
|
||
| ## インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i @charcoal/foundation | ||
| ``` | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add @charcoal/foundation | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # `@charcoal/pixiv-theme` | ||
|
|
||
| TODO | ||
|
|
||
| ## インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i @charcoal/pixiv-theme | ||
| ``` | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add @charcoal/pixiv-theme | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # `@charcoal/theme` | ||
|
|
||
| charcoal 全体で制約されるテーマ構造の型を提供します。 | ||
|
|
||
| ## インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i --save-dev @charcoal/theme | ||
| ``` | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add -D @charcoal/theme | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,31 @@ | ||
| # @charcoal ― PIXIV Design System monorepo | ||
| # charcoal について | ||
|
|
||
| This is the monorepo for the `@charcoal` packages by pixiv. | ||
| charcoal はピクシブ株式会社のデザインシステムです。ここでは特に、Web フロントエンドの実装に用いる npm パッケージ集のことを言います。 | ||
|
|
||
| # Development | ||
| ## charcoal という名前 | ||
|
|
||
| ## Setup | ||
| 「charcoal(木炭)」とはデッサンの道具であり、線を引く、表現の基礎となる素材の一つです。また創作物を主役とするサービスの基盤として、それ自体は色を持たないモノクロの素材である、というニュアンスも含みます。 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. めちゃよいですね。ここでコンセプトの説明がされていればリード文でコンセプトについて触れなくてもよいかもしれない。 |
||
|
|
||
| Requires `yarn` and `nodenv`. | ||
| ## 設計思想 | ||
|
|
||
| ```sh | ||
| nodenv install `cat .node-version` | ||
| yarn install | ||
| yarn lerna bootstrap | ||
| yarn build | ||
| ``` | ||
| charcoal はいわゆるコンポーネント実装も含みますが、それ以外にも UI の実装に必要なパッケージを多数収録しています。charcoal の設計思想は「定数」「ユーティリティ」「コンポーネント」の三層構造として説明されます。 | ||
|
|
||
| You should build all the packages first so that each package can import another `@charcoal/*` | ||
| package. | ||
|  | ||
|
|
||
| ## Commit | ||
| - 定数(constants): デザインシステム上にどういう色やスペーシングのルールがあるかを表す。デザイントークン。 | ||
| - ユーティリティ(utilities): 定数の値を CSS の表現に落とし込み、マークアップに使えるようにしたもの。 | ||
| - コンポーネント(components): 見た目と挙動が一体になった、それ単体で利用可能な UI の部品。 | ||
|
|
||
| `@charcoal` is using [commintlint](https://github.com/conventional-changelog/commitlint) and | ||
| following the [Conventional Commits](https://www.conventionalcommits.org/ja/v1.0.0/) rules. | ||
| ## charcoal のはじめ方 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 大文字小文字表記が揺れているのでルールがあったほうが良さそう
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 最初は大文字の気持ちでした。たしかにルール無さそう。 |
||
|
|
||
| charcoal を導入する場合、最初にまず自分たちの技術スタックに適した「ユーティリティ」を選択します。 | ||
|
|
||
| 以下のフローチャートに従って、`tailwind-config` か `styled` を選択してください。 | ||
|
|
||
|  | ||
|
|
||
| - **Q. React を使用しているか?** | ||
| - No → [tailwind-config](pages/utilities/tailwind-config.md) を使用する | ||
| - Yes → **Q. styled-components を使用しているか?** | ||
| - No → [tailwind-config](pages/utilities/tailwind-config.md) を使用する | ||
| - Yes → [styled](pages/utilities/styled.md) を使用する | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # `@charcoal/icons-cli` | ||
|
|
||
| Figma からアイコンの SVG をダウンロードし、GitHub に自動で更新の Pull Request を作成します。 | ||
|
|
||
| GitLab にも対応しています。 | ||
|
|
||
| ## インストール | ||
|
|
||
| npm | ||
|
|
||
| ```bash | ||
| npm i --save-dev @charcoal/icons-cli | ||
| ``` | ||
|
|
||
| yarn | ||
|
|
||
| ```bash | ||
| yarn add -D @charcoal/icons-cli | ||
| ``` | ||
|
|
||
| ## 使い方 | ||
|
|
||
| ### Figma からアイコンをダウンロードする | ||
|
|
||
| ```bash | ||
| yarn icons-cli figma:export | ||
| ``` | ||
|
|
||
| 必要な環境変数は以下です。 | ||
|
|
||
| | 名前 | 必須 | 説明 | | ||
| | --------------- | ---- | ------------------------------------------------------------ | | ||
| | FIGMA_FILE_URL | yes | Figma の URL です。node-id は含んでいても良いです | | ||
| | FIGMA_TOKEN | yes | Figma API のアクセストークンです | | ||
| | OUTPUT_ROOT_DIR | yes | svg をダウンロードするディレクトリ( 例: `packages/icons` ) | | ||
|
|
||
| Figma 内のコンポーネントは以下の命名規則に従います( 例: `16/Add` `Inline/Add` )。 | ||
|
|
||
| - `/` を含む | ||
| - `/` の前は数字あるいは `Inline` | ||
|
|
||
| ### SVG ファイルにアイコン向けの変換をかける | ||
|
|
||
| ```bash | ||
| yarn icons-cli svg:optimize --file path/to/file --color "#000" | ||
| ``` | ||
|
|
||
| ダウンロードしたファイルに SVGO による最適化をかけつつ、指定した色を `currentColor` に置換します。 | ||
|
|
||
| ### GitHub に Pull Request を作成する | ||
|
|
||
| ```bash | ||
| yarn icons-cli github:pr | ||
| ``` | ||
|
|
||
| 必要な環境変数は以下です。 | ||
|
|
||
| | 名前 | 必須 | 説明 | | ||
| | --------------------- | ---- | ------------------------------------------------ | | ||
| | GITHUB_ACCESS_TOKEN | yes | GitHub のアクセストークンです | | ||
| | GITHUB_REPO_OWNER | no | リポジトリの owner です( 例: pixiv ) | | ||
| | GITHUB_REPO_NAME | no | リポジトリ名です( 例: charcoal ) | | ||
| | GITHUB_DEFAULT_BRANCH | no | リポジトリのデフォルトブランチです( 例: main ) | | ||
|
|
||
| ### GitLab に Pull Request を作成する | ||
|
|
||
| ```bash | ||
| yarn icons-cli gitlab:mr | ||
| ``` | ||
|
|
||
| 必要な環境変数は以下です。 | ||
|
|
||
| | 名前 | 必須 | 説明 | | ||
| | --------------------- | ---- | ----------------------------------------------------------------------------- | | ||
| | GITLAB_PROJECT_ID | yes | GitLab のプロジェクト ID(数値)です | | ||
| | GITLAB_ACCESS_TOKEN | yes | GitLab のアクセストークンです | | ||
| | GITLAB_HOST | no | GitLab のホスト名(セルフホスティング版の場合は自身のサーバーのホスト名)です | | ||
| | GITLAB_DEFAULT_BRANCH | no | リポジトリのデフォルトブランチです( 例: main ) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: ここのフレーズは後で変える