-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
165 additions
and
11 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @takanorip @8845musign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
name: pageComponent | ||
root: 'src' | ||
output: '.' | ||
ignore: [] | ||
questions: | ||
componentName: What is the component name (e.g., link-button)? | ||
--- | ||
|
||
# `components/react/examples/{{ inputs.componentName }}/Default.tsx` | ||
|
||
```typescript | ||
import { {{ inputs.componentName | pascal }} } from '@ubie/ubie-ui'; | ||
import type { FC } from 'react'; | ||
|
||
export const DefaultExample: FC = () => { | ||
return ( | ||
<{{ inputs.componentName | pascal }} /> | ||
); | ||
}; | ||
|
||
``` | ||
|
||
# `pages/components/examples/{{ inputs.componentName }}/default.astro` | ||
|
||
```astro | ||
--- | ||
import { DefaultExample } from '@components/react/examples/{{ inputs.componentName }}/Default'; | ||
import ExampleLayout from '@layouts/ExampleLayout.astro'; | ||
--- | ||
<ExampleLayout title="Default Example | {{ inputs.componentName | pascal }}"> | ||
<DefaultExample client:only="react" /> | ||
</ExampleLayout> | ||
``` | ||
|
||
|
||
|
||
# `pages/components/{{ inputs.componentName }}.mdx` | ||
|
||
```markdown | ||
--- | ||
title: '{{ inputs.componentName | pascal }}' | ||
exampleKey: '{{ inputs.componentName }}' | ||
layout: '@layouts/ComponentLayout.astro' | ||
description: '' | ||
thumbnail: '/assets/images/components/thumbnail-default.svg' | ||
--- | ||
|
||
## Feature | ||
|
||
Describe the characteristics of the component. Describe the use cases to which it is applicable and how it differs from other components. | ||
|
||
## Usage | ||
|
||
Please describe the specific use of the product. Detailed notes on use, code example, etc. | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Toggle } from '@ubie/ubie-ui'; | ||
import { useState, type FC, type ChangeEventHandler, useCallback } from 'react'; | ||
|
||
export const DefaultExample: FC = () => { | ||
const [isChecked, setIsChecked] = useState<boolean>(false); | ||
|
||
const handleChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => { | ||
setIsChecked(event.target.checked); | ||
}, []); | ||
|
||
return <Toggle checked={isChecked} onChange={handleChange} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Toggle } from '@ubie/ubie-ui'; | ||
import { useState, type FC, type ChangeEventHandler, useCallback } from 'react'; | ||
|
||
export const DisabledExample: FC = () => { | ||
const [isChecked, setIsChecked] = useState<boolean>(false); | ||
|
||
const handleChange: ChangeEventHandler<HTMLInputElement> = useCallback((event) => { | ||
setIsChecked(event.target.checked); | ||
}, []); | ||
|
||
return <Toggle checked={isChecked} onChange={handleChange} disabled />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
import { DefaultExample } from '@components/react/examples/toggle/Default'; | ||
import ExampleLayout from '@layouts/ExampleLayout.astro'; | ||
--- | ||
|
||
<ExampleLayout title="Default Example | Toggle"> | ||
<DefaultExample client:only="react" /> | ||
</ExampleLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
import { DisabledExample } from '@components/react/examples/toggle/Disabled'; | ||
import ExampleLayout from '@layouts/ExampleLayout.astro'; | ||
--- | ||
|
||
<ExampleLayout title="Disabled Example | Toggle"> | ||
<DisabledExample client:only="react" /> | ||
</ExampleLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: 'Toggle' | ||
exampleKey: 'toggle' | ||
layout: '@layouts/ComponentLayout.astro' | ||
description: '設定をオンまたはオフに切り替えるためのコンポーネント' | ||
thumbnail: '/assets/images/components/thumbnail-toggle.svg.svg' | ||
--- | ||
|
||
## Feature | ||
|
||
- 設定項目が2つの状態のみを持つ場合(例えば、設定の有効/無効)に適しています。 | ||
- ユーザーが行った選択をすぐに反映させるシナリオに適しており、直感的に操作できるように設計されています。 | ||
|
||
## Usage | ||
|
||
- `checked` と `onChange` を使用して値をコントロールして使用してください。 | ||
- `onChange` で通信を伴うなど待機時間が生まれる場合には、楽観的に状態を更新することが好まれます。 |