forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
423 additions
and
2,105 deletions.
There are no files selected for viewing
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
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
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
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,83 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import MenuGroup from '..'; | ||
import MenuItem from '../../menu-item'; | ||
import MenuItemsChoice from '../../menu-items-choice'; | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
const meta: ComponentMeta< typeof MenuGroup > = { | ||
title: 'Components/MenuGroup', | ||
component: MenuGroup, | ||
argTypes: { | ||
children: { control: { type: null } }, | ||
}, | ||
parameters: { | ||
controls: { expanded: true }, | ||
docs: { source: { state: 'open' } }, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
const Template: ComponentStory< typeof MenuGroup > = ( args ) => { | ||
return ( | ||
<MenuGroup { ...args }> | ||
<MenuItem>Menu Item 1</MenuItem> | ||
<MenuItem>Menu Item 2</MenuItem> | ||
</MenuGroup> | ||
); | ||
}; | ||
|
||
export const Default: ComponentStory< typeof MenuGroup > = Template.bind( {} ); | ||
|
||
const MultiGroupsTemplate: ComponentStory< typeof MenuGroup > = ( args ) => { | ||
const [ mode, setMode ] = useState( 'visual' ); | ||
const choices = [ | ||
{ | ||
value: 'visual', | ||
label: 'Visual editor', | ||
}, | ||
{ | ||
value: 'text', | ||
label: 'Code editor', | ||
}, | ||
]; | ||
|
||
return ( | ||
<> | ||
<MenuGroup label={ 'View' }> | ||
<MenuItem>Top Toolbar</MenuItem> | ||
<MenuItem>Spotlight Mode</MenuItem> | ||
<MenuItem>Distraction Free</MenuItem> | ||
</MenuGroup> | ||
<MenuGroup { ...args }> | ||
<MenuItemsChoice | ||
choices={ choices } | ||
value={ mode } | ||
onSelect={ ( newMode: string ) => setMode( newMode ) } | ||
onHover={ () => {} } | ||
/> | ||
</MenuGroup> | ||
</> | ||
); | ||
}; | ||
|
||
/** | ||
* When other menu items exist above or below a MenuGroup, the group | ||
* should have a divider line between it and the adjacent item. | ||
*/ | ||
export const WithSeperator = MultiGroupsTemplate.bind( {} ); | ||
WithSeperator.args = { | ||
...Default.args, | ||
hideSeparator: false, | ||
label: 'Editor', | ||
}; |
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 |
---|---|---|
@@ -1,22 +1,5 @@ | ||
# (Next) Component System | ||
# TODO | ||
|
||
This directory contains the code for next Component System. | ||
We want to get rid of this folder. Don't add anything new here. | ||
|
||
More information can be found in the original GitHub issue: | ||
https://github.com/WordPress/gutenberg/issues/27484 | ||
|
||
## Usage | ||
|
||
(This is still very much a work in progress) | ||
|
||
```jsx | ||
import { Text, View } from '@wordpress/components/ui'; | ||
|
||
function Example() { | ||
return ( | ||
<View> | ||
<Text>Code is Poetry</Text> | ||
</View> | ||
); | ||
} | ||
``` | ||
What is left of this folder should either be deleted (if unused elsewhere), or be moved into the root `packages/components/src` and `packages/components/src/utils` folders. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.