chore: 🤖 Add centered layout component to rose addon

This commit is contained in:
Susmitha Girumala committed 2020-06-11 21:03:49 -04:00
1 parent 20eb21f028
commit ab083f38f9
9 files changed
+137 -45

No files matched your search

@@ -0,0 +1,7 @@
import Component from '@ember/component';
import layout from '../../../templates/components/rose/layout/centered';
export default Component.extend({
layout,
tagName: '',
});
@@ -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';
<Meta title="Rose|Layout|Centered" component="Centered" />
# Layout|Centered
A left and right centered layout/positioning component that allows a boby section to be configured
```htmlbars
<Rose::Layout::Centered as |layout|>
<layout.body />
</Rose::Layout::Centered>
```
<Preview>
<Story name="Centered">{{
template: hbs`
<Rose::Layout::Centered as |layout|>
<layout.body style="background: var(--brand-gray-7);">Centered Body</layout.body>
</Rose::Layout::Centered>
`,
}}</Story>
</Preview>
@@ -0,0 +1,11 @@
@use '../../variables/sizing';
.rose-layout-centered {
display: flex;
flex-direction: column;
.rose-layout-centered-body {
margin: auto;
padding: sizing.rems(l) + sizing.rems(xxs) 0; //35px
}
}
@@ -1,2 +1,3 @@
@import 'global';
@import 'page';
@import 'centered';
@@ -0,0 +1,5 @@
<div ...attributes class="rose-layout-centered">
{{yield (hash
body=(component "rose/anonymous" tagName="section" class="rose-layout-centered-body")
)}}
</div>
@@ -0,0 +1 @@
export { default } from 'rose/components/rose/layout/centered';
+11 -45
View File
@@ -1,46 +1,12 @@
<Rose::Message @title="You are not authorized" @subtitle="Error 403" @icon="disabled" as |message|>
<message.description>
You must be granted permissions to view this data.
Ask your administrator if you think you should have access.
</message.description>
<message.link @route="index">
<Rose::Icon @name="chevron-left" />
Go back
</message.link>
<message.link @route="index">Need help?</message.link>
</Rose::Message>
<Rose::Layout::Centered />
<Rose::Message @title="Page Not Found" @subtitle="Error 404" @icon="help-circle-outline" as |message|>
<message.description>
Sorry, we couldn't find the page you were looking for. You can go back or to one of the links below.
</message.description>
<message.link @route="index">
<Rose::Icon @name="chevron-left" />
Go back
</message.link>
<message.link @route="index">Need help?</message.link>
</Rose::Message>
<Rose::Message @title="Something went wrong" @subtitle="Error 500" @icon="alert-circle-outline" as |message|>
<message.description>
We ran into a problem and could not continue. You can ask your administrator or try again later.
</message.description>
<message.link @route="index">
<Rose::Icon @name="refresh-default" />
Try Again
</message.link>
<message.link @route="index">Need help?</message.link>
</Rose::Message>
<Rose::Message @title="No logs received yet" as |message|>
<message.description>
Your logs will appear here when we start receiving them. If your server is currently outputting logs, check your configuration.
</message.description>
</Rose::Message>
<Rose::Message @title="Welcome to Namespaces" as |message|>
<message.description>
Namespaces allow you to create distinct areas with their own separate policies, mounts, tokens, and identity entities.
</message.description>
<message.link @route="index">Add a namespace</message.link>
</Rose::Message>
<Rose::Layout::Centered as |layout|>
<layout.body>
<Rose::Message @title="Welcome to Namespaces" as |message|>
<message.description>
Namespaces allow you to create distinct areas with their own separate policies, mounts, tokens, and identity entities.
</message.description>
<message.link @route="index">Add a namespace</message.link>
</Rose::Message>
</layout.body>
</Rose::Layout::Centered>
@@ -237,5 +237,52 @@
<breadcrumbs.link @route="about">Level 4</breadcrumbs.link>
<breadcrumbs.link @route="about">Level 5</breadcrumbs.link>
</Rose::Nav::Breadcrumbs>
<Rose::Message @title="You are not authorized" @subtitle="Error 403" @icon="disabled" as |message|>
<message.description>
You must be granted permissions to view this data.
Ask your administrator if you think you should have access.
</message.description>
<message.link @route="index">
<Rose::Icon @name="chevron-left" />
Go back
</message.link>
<message.link @route="index">Need help?</message.link>
</Rose::Message>
<Rose::Message @title="Page Not Found" @subtitle="Error 404" @icon="help-circle-outline" as |message|>
<message.description>
Sorry, we couldn't find the page you were looking for. You can go back or to one of the links below.
</message.description>
<message.link @route="index">
<Rose::Icon @name="chevron-left" />
Go back
</message.link>
<message.link @route="index">Need help?</message.link>
</Rose::Message>
<Rose::Message @title="Something went wrong" @subtitle="Error 500" @icon="alert-circle-outline" as |message|>
<message.description>
We ran into a problem and could not continue. You can ask your administrator or try again later.
</message.description>
<message.link @route="index">
<Rose::Icon @name="refresh-default" />
Try Again
</message.link>
<message.link @route="index">Need help?</message.link>
</Rose::Message>
<Rose::Message @title="No logs received yet" as |message|>
<message.description>
Your logs will appear here when we start receiving them. If your server is currently outputting logs, check your configuration.
</message.description>
</Rose::Message>
<Rose::Message @title="Welcome to Namespaces" as |message|>
<message.description>
Namespaces allow you to create distinct areas with their own separate policies, mounts, tokens, and identity entities.
</message.description>
<message.link @route="index">Add a namespace</message.link>
</Rose::Message>
</layout.body>
</Rose::Layout::Global>
@@ -0,0 +1,29 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/layout/centered', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Layout::Centered />`);
assert.ok(find('.rose-layout-centered'));
assert.notOk(find('.rose-layout-centered-body'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Layout::Centered id="layout"/>`);
assert.ok(find('#layout'));
});
test('it renders with content', async function (assert) {
await render(hbs`<Rose::Layout::Centered as |layout|>
<layout.body>Layout content</layout.body>
</Rose::Layout::Centered>`);
assert.equal(
find('.rose-layout-centered').textContent.trim(),
'Layout content'
);
});
});