feat: Add global footer
This commit is contained in:
29 files changed
+355
-1
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<LinkTo
|
||||
...attributes
|
||||
class="rose-footer-brand"
|
||||
title={{@text}}
|
||||
@route={{if @route @route "index"}}
|
||||
>
|
||||
|
||||
{{#if @logo}}
|
||||
{{inline-svg @logo}}
|
||||
{{/if}}
|
||||
|
||||
</LinkTo>
|
||||
@@ -0,0 +1,11 @@
|
||||
<span class="rose-footer-copyright">
|
||||
<span class="rose-footer-copyright-symbol">
|
||||
©
|
||||
</span>
|
||||
<span class="rose-footer-copyright-year">
|
||||
{{this.currentYear}}
|
||||
</span>
|
||||
<span class="rose-footer-copyright-text">
|
||||
{{@text}}
|
||||
</span>
|
||||
</span>
|
||||
@@ -0,0 +1,8 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
||||
export default class RoseFooterCopyrightComponent extends Component {
|
||||
|
||||
// =attributes
|
||||
currentYear = new Date().getFullYear();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<footer
|
||||
...attributes
|
||||
class="rose-footer"
|
||||
>
|
||||
{{yield (hash
|
||||
brand=(component 'rose/footer/brand')
|
||||
copyright=(component 'rose/footer/copyright')
|
||||
product=(component 'rose/footer/product')
|
||||
nav=(component 'rose/footer/nav')
|
||||
)}}
|
||||
</footer>
|
||||
@@ -0,0 +1,42 @@
|
||||
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { text } from '@storybook/addon-knobs';
|
||||
|
||||
<Meta title="Rose|Footer" component="Footer" />
|
||||
|
||||
# Footer
|
||||
|
||||
A footer component that allows four distinct sections to be configured: brand, nav, product, and copyright.
|
||||
|
||||
```html
|
||||
<Rose::Footer as |footer|>
|
||||
<footer.brand @logo="logo" @text="Product Name" />
|
||||
<footer.copyright @text="Company Name" />
|
||||
<footer.product @text="Product Name" @version="1.0" />
|
||||
<footer.nav as |nav|>
|
||||
<nav.external-link @route="index">Section</nav.external-link>
|
||||
<nav.external-link @route="about">Section</nav.external-link>
|
||||
</footer.nav>
|
||||
</Rose::Footer>
|
||||
```
|
||||
|
||||
<Preview>
|
||||
<Story name="Basic">{{
|
||||
template: hbs`
|
||||
<Rose::Footer as |footer|>
|
||||
<footer.brand @logo="logo" @text={{brandName}} />
|
||||
<footer.copyright @text={{copyright}} />
|
||||
<footer.product @text={{brandName}} @version="1.0" />
|
||||
<footer.nav as |nav|>
|
||||
<nav.external-link @route="index">Section</nav.external-link>
|
||||
<nav.external-link @route="about">Section</nav.external-link>
|
||||
</footer.nav>
|
||||
</Rose::Footer>
|
||||
`,
|
||||
context: {
|
||||
brandName: text('brandName', 'Brand Name'),
|
||||
copyright: text('copyright', 'Company Name'),
|
||||
},
|
||||
}}</Story>
|
||||
</Preview>
|
||||
@@ -0,0 +1,7 @@
|
||||
<a target="_blank"
|
||||
href={{@href}}
|
||||
class="rose-footer-nav-external-link"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{yield}}
|
||||
</a>
|
||||
@@ -0,0 +1,5 @@
|
||||
<nav class="rose-footer-nav" aria-label="footer-nav">
|
||||
{{yield (hash
|
||||
external-link=(component 'rose/footer/nav/external-link')
|
||||
)}}
|
||||
</nav>
|
||||
@@ -0,0 +1,11 @@
|
||||
<span class="rose-footer-product">
|
||||
<span class="rose-footer-product-text">
|
||||
{{@text}}
|
||||
</span>
|
||||
|
||||
{{#if @version}}
|
||||
<span class="rose-footer-product-version">
|
||||
v{{@version}}
|
||||
</span>
|
||||
{{/if}}
|
||||
</span>
|
||||
@@ -2,6 +2,7 @@
|
||||
@import 'dropdown';
|
||||
@import 'form';
|
||||
@import 'header';
|
||||
@import 'footer';
|
||||
@import 'layout';
|
||||
@import 'icon';
|
||||
@import 'list';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
@use '../../variables/sizing';
|
||||
|
||||
.rose-footer-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: var(--ui-gray-starker-1);
|
||||
margin: sizing.rems(xs);
|
||||
|
||||
svg {
|
||||
$logoSize: sizing.rems(m);
|
||||
display: inline-block;
|
||||
width: $logoSize;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
@use '../../variables/sizing';
|
||||
|
||||
.rose-footer-copyright {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
.rose-footer-copyright-symbol {
|
||||
margin-right: sizing.rems(xxxs);
|
||||
}
|
||||
|
||||
.rose-footer-copyright-year {
|
||||
margin-right: sizing.rems(xxs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@use '../../variables/sizing';
|
||||
|
||||
.rose-footer-nav-external-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin-right: sizing.rems(s);
|
||||
text-decoration: underline;
|
||||
color: var(--ui-gray-starker-1);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
@use '../../variables/sizing';
|
||||
@use '../../variables/media';
|
||||
@use '../../utilities/type';
|
||||
|
||||
@import 'brand';
|
||||
@import 'nav';
|
||||
@import 'product';
|
||||
@import 'copyright';
|
||||
@import 'external-link';
|
||||
|
||||
.rose-footer {
|
||||
@include type.type(xs);
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: var(--ui-gray-starker-1);
|
||||
height: sizing.rems(xxl) + sizing.rems(xxs); //65px
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@use '../../variables/sizing';
|
||||
|
||||
.rose-footer-nav {
|
||||
grid-area: nav;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-right: sizing.rems(s);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@use '../../variables/sizing';
|
||||
|
||||
.rose-footer-product {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0 sizing.rems(l);
|
||||
|
||||
.rose-footer-product-version {
|
||||
margin-left: sizing.rems(xxxs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/footer';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/footer/brand';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/footer/copyright';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/footer/nav';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/footer/nav/external-link';
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from 'rose/components/rose/footer/product';
|
||||
@@ -0,0 +1,51 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | rose/footer', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(5);
|
||||
await render(hbs`<Rose::Footer />`);
|
||||
assert.ok(find('.rose-footer'));
|
||||
assert.notOk(find('.rose-footer-nav'));
|
||||
assert.notOk(find('.rose-footer-brand'));
|
||||
assert.notOk(find('.rose-footer-product'));
|
||||
assert.notOk(find('.rose-footer-copyright'));
|
||||
});
|
||||
|
||||
test('it renders with brand', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer as |footer| >
|
||||
<footer.brand />
|
||||
</Rose::Footer>`);
|
||||
assert.ok(find('.rose-footer-brand'));
|
||||
});
|
||||
|
||||
test('it renders with nav', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer as |footer| >
|
||||
<footer.nav />
|
||||
</Rose::Footer>`);
|
||||
assert.ok(find('.rose-footer-nav'));
|
||||
});
|
||||
|
||||
test('it renders with product', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer as |footer| >
|
||||
<footer.product @text="boundary"/>
|
||||
</Rose::Footer>`);
|
||||
assert.ok(find('.rose-footer-product'));
|
||||
});
|
||||
|
||||
test('it renders with copyright', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer as |footer| >
|
||||
<footer.copyright @text="copyright"/>
|
||||
</Rose::Footer>`);
|
||||
assert.ok(find('.rose-footer-copyright'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | rose/footer/brand', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(2);
|
||||
await render(hbs`<Rose::Footer::Brand @logo="logo" @text="Product Name" />`);
|
||||
assert.ok(find('.rose-footer-brand'));
|
||||
assert.ok(find('.rose-footer-brand svg'));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | rose/footer/copyright', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer::Copyright @text="copyright" />`);
|
||||
assert.equal(find('.rose-footer-copyright-text').textContent.trim(), 'copyright');
|
||||
});
|
||||
|
||||
test('it renders with current year', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer::Copyright />`);
|
||||
assert.equal(find('.rose-footer-copyright-year').textContent.trim(), new Date().getFullYear());
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find, findAll } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | rose/footer/nav', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer::nav />`);
|
||||
assert.ok(find('.rose-footer-nav'));
|
||||
});
|
||||
|
||||
test('it renders nav external link elements', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer::nav as |nav| >
|
||||
<nav.external-link @href="index"/>
|
||||
<nav.external-link @href="about"/>
|
||||
</Rose::Footer::nav>`);
|
||||
assert.equal(findAll('a').length, 2);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | rose/footer/nav/external-link', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders with link', async function (assert) {
|
||||
assert.expect(2);
|
||||
await render(hbs`<Rose::Footer::Nav::ExternalLink />`);
|
||||
assert.ok(find('a'));
|
||||
assert.ok(find('.rose-footer-nav-external-link'));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, find } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Component | rose/footer/product', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders with product', async function (assert) {
|
||||
assert.expect(3);
|
||||
await render(hbs`<Rose::Footer::Product @text="boundary" />`);
|
||||
assert.ok(find('.rose-footer-product'));
|
||||
assert.equal(find('.rose-footer-product-text').textContent.trim(), 'boundary');
|
||||
assert.notOk(find('.rose-footer-product-version'));
|
||||
});
|
||||
|
||||
test('it renders with product and version', async function (assert) {
|
||||
assert.expect(1);
|
||||
await render(hbs`<Rose::Footer::Product @version="1.0" />`);
|
||||
assert.equal(find('.rose-footer-product-version').textContent.trim(), 'v1.0');
|
||||
});
|
||||
});
|
||||
@@ -37,6 +37,17 @@
|
||||
{{outlet}}
|
||||
</layout.body>
|
||||
|
||||
<layout.footer>
|
||||
<Rose::Footer as |footer|>
|
||||
<footer.brand @logo="logo-hashi" @text={{t "hashicorp.title"}} />
|
||||
<footer.copyright @text={{t "hashicorp.title"}} />
|
||||
<footer.product @text={{app-name}} @version={{t "boundary.version"}} />
|
||||
<footer.nav as |nav|>
|
||||
<nav.external-link @href={{t "hashicorp.documentation.link"}}>{{t "hashicorp.documentation.title"}}</nav.external-link>
|
||||
</footer.nav>
|
||||
</Rose::Footer>
|
||||
</layout.footer>
|
||||
|
||||
</Rose::Layout::Global>
|
||||
|
||||
<EmberNotify @closeAfter={{this.notifyTimeout}} as |message close|>
|
||||
|
||||
@@ -17,4 +17,11 @@ titles:
|
||||
global: Global
|
||||
actions: Actions
|
||||
descriptions:
|
||||
empty-set: There are no items to display yet. You may be able to add items or try back later.
|
||||
empty-set: There are no items to display yet. You may be able to add items or try back later.
|
||||
hashicorp:
|
||||
title: HashiCorp
|
||||
documentation:
|
||||
title: Documentation
|
||||
link: https://boundaryproject.io
|
||||
boundary:
|
||||
version: '0.1'
|
||||
Reference in new issue
Block a user