refactor: 💡 replace layout regions with anonymous component
This commit is contained in:
47 files changed
+108
-362
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../templates/components/rose/anonymous';
|
||||
|
||||
/**
|
||||
* An otherwise empty component that renders a block. Used only by components
|
||||
* that yield simple contextual components, such as layouts yielding regions.
|
||||
*/
|
||||
export default Component.extend({
|
||||
layout
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { text, boolean, select } from '@storybook/addon-knobs';
|
||||
|
||||
<Meta title="Rose|Anonymous" component="Anonymous" />
|
||||
|
||||
# Anonymous
|
||||
|
||||
The anonymous component is a simple `<div>` with no attributes of its own.
|
||||
It is used by other components that need to yield contextual components.
|
||||
This component should not be instantiated directly.
|
||||
|
||||
For example, layout components may yield an anonymous component to configure
|
||||
various layout regions:
|
||||
|
||||
```htmlbars
|
||||
<div ...attributes class="rose-layout-global">
|
||||
{{yield (hash
|
||||
header=(component "rose/anonymous" tagName="header" class="rose-layout-global-header")
|
||||
sidebar=(component "rose/anonymous" tagName="aside" class="rose-layout-global-sidebar")
|
||||
body=(component "rose/anonymous" tagName="main" class="rose-layout-global-body")
|
||||
)}}
|
||||
</div>
|
||||
```
|
||||
@@ -10,20 +10,20 @@ import { text, boolean, select } from '@storybook/addon-knobs';
|
||||
A top-level layout/positioning component that allows three distinct sections to be configured: header, navigation, and body.
|
||||
|
||||
```htmlbars
|
||||
<Rose::Layout::Global as |global|>
|
||||
<global.header />
|
||||
<global.body />
|
||||
<global.navigation />
|
||||
<Rose::Layout::Global as |layout|>
|
||||
<layout.header />
|
||||
<layout.sidebar />
|
||||
<layout.body />
|
||||
</Rose::Layout::Global>
|
||||
```
|
||||
|
||||
<Preview>
|
||||
<Story name="Global">{{
|
||||
template: hbs`
|
||||
<Rose::Layout::Global as |global|>
|
||||
<global.header style="background: var(--brand-gray-5);">Header</global.header>
|
||||
<global.body style="background: var(--brand-gray-7);">Body</global.body>
|
||||
<global.navigation style="background: var(--brand-gray-6);">Navigation</global.navigation>
|
||||
<Rose::Layout::Global as |layout|>
|
||||
<layout.header style="background: var(--brand-gray-5);">Header</layout.header>
|
||||
<layout.sidebar style="background: var(--brand-gray-6);">Sidebar</layout.sidebar>
|
||||
<layout.body style="background: var(--brand-gray-7);">Body</layout.body>
|
||||
</Rose::Layout::Global>
|
||||
`,
|
||||
}}</Story>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/global/body';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/global/header';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/global/navigation';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/page/actions';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/page/body';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/page/breadcrumbs';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/page/header';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../../templates/components/rose/layout/page/navigation';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
Reference in new issue
Block a user