Merge branch 'develop' into chore-cards

This commit is contained in:
Randall Morey authored and GitHub committed 2020-06-09 18:08:42 -04:00
commit 8609d1c99f
9 files changed
+133 -23

No files matched your search

@@ -0,0 +1,10 @@
import Component from '@ember/component';
import layout from '../../../templates/components/rose/nav/breadcrumbs';
/**
* A navigation component with links.
*/
export default Component.extend({
layout,
tagName: '',
});
@@ -0,0 +1,27 @@
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
import { hbs } from 'ember-cli-htmlbars';
import { action } from '@storybook/addon-actions';
<Meta title="Rose|Nav|Breadcrumbs" component="Nav/Breadcrumbs" />
# Breadcrumbs Navigation
A breadcrumbs component with links as crumbs.
```html
<Rose::Nav::Breadcrumbs as |breadcrumbs|>
<breadcrumbs.link @route="about">Level 1</breadcrumbs.link>
<breadcrumbs.link @route="index">Level 2</breadcrumbs.link>
</Rose::Nav::Breadcrumbs>
```
<Preview>
<Story name="Basic Breadcrumbs">{{
template: hbs`
<Rose::Nav::Breadcrumbs as |breadcrumbs|>
<breadcrumbs.link @route="about">Level 1</breadcrumbs.link>
<breadcrumbs.link @route="index">Level 2</breadcrumbs.link>
</Rose::Nav::Breadcrumbs>
`,
}}</Story>
</Preview>
@@ -0,0 +1,32 @@
@use '../../variables/sizing';
@use '../../utilities/type';
.rose-nav-breadcrumbs {
@include type.type(s, normal);
display: flex;
flex-wrap: wrap;
.rose-nav-breadcrumbs-link {
--color: var(--ui-gray);
color: var(--color);
text-decoration: none;
cursor: pointer;
&:hover {
--color: var(--action);
&::after {
color: var(--ui-gray);
}
}
&::after {
content: '\002F'; // "/"
margin: 0 sizing.rems(xs);
}
&:last-child::after {
content: '';
}
}
}
@@ -1,2 +1,3 @@
@import 'sidebar';
@import 'tabs';
@import 'breadcrumbs';
@@ -0,0 +1,5 @@
<nav ...attributes class="rose-nav-breadcrumbs" aria-label="breadcrumbs">
{{yield (hash
link=(component "link-to" class="rose-nav-breadcrumbs-link")
)}}
</nav>
@@ -0,0 +1 @@
export { default } from 'rose/components/rose/nav/breadcrumbs';
@@ -1,23 +1,7 @@
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>Address</row.cell>
<row.cell>Host Set</row.cell>
<row.cell>Name</row.cell>
<row.cell>Description</row.cell>
</header.row>
</table.header>
<table.body as |body|>
<body.row as |row|>
<row.cell>1.1.1.1</row.cell>
<row.cell>host-set-1, host-set-2</row.cell>
<row.cell>optional name</row.cell>
<row.cell>description</row.cell>
</body.row>
</table.body>
<table.footer as |footer|>
<footer.row as |row|>
<row.cell>Footer</row.cell>
</footer.row>
</table.footer>
</Rose::Table>
<Rose::Nav::Breadcrumbs as |breadcrumbs|>
<breadcrumbs.link @route="about">Level 1</breadcrumbs.link>
<breadcrumbs.link @route="index">Level 2</breadcrumbs.link>
<breadcrumbs.link @route="about">Level 3</breadcrumbs.link>
<breadcrumbs.link @route="about">Level 4</breadcrumbs.link>
<breadcrumbs.link @route="about">Level 5</breadcrumbs.link>
</Rose::Nav::Breadcrumbs>
@@ -205,5 +205,29 @@
<Rose::Card::Link @title="I'm a card" />
<Rose::Card::Link @title="I'm a card" @description="I'm a description" />
<Rose::Card::Link @title="I'm a card" @description="I'm a description" @subtitle="I'm a subtitle"/>
<Rose::Table as |table|>
<table.header as |header|>
<header.row as |row|>
<row.cell>Address</row.cell>
<row.cell>Host Set</row.cell>
<row.cell>Name</row.cell>
<row.cell>Description</row.cell>
</header.row>
</table.header>
<table.body as |body|>
<body.row as |row|>
<row.cell>1.1.1.1</row.cell>
<row.cell>host-set-1, host-set-2</row.cell>
<row.cell>optional name</row.cell>
<row.cell>description</row.cell>
</body.row>
</table.body>
<table.footer as |footer|>
<footer.row as |row|>
<row.cell>Footer</row.cell>
</footer.row>
</table.footer>
</Rose::Table>
</global.body>
</Rose::Layout::Global>
@@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find, findAll } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | rose/nav/breadcrumbs', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
await render(hbs`<Rose::Nav::Breadcrumbs />`);
assert.ok(find('.rose-nav-breadcrumbs'));
});
test('it renders with attributes', async function (assert) {
await render(hbs`<Rose::Nav::Breadcrumbs id="breadcrumbs"/>`);
assert.ok(find('#breadcrumbs'));
});
test('it renders with breadcrumb links', async function (assert) {
await render(hbs`<Rose::Nav::Breadcrumbs as |breadcrumbs|>
<breadcrumbs.link @route="index" />
<breadcrumbs.link @route="index" />
</Rose::Nav::Breadcrumbs>`);
assert.equal(findAll('.rose-nav-breadcrumbs-link').length, 2);
});
});