diff --git a/addons/rose/addon/components/rose/anonymous.js b/addons/rose/addon/components/rose/anonymous.js index 74592a562..c5321f53a 100644 --- a/addons/rose/addon/components/rose/anonymous.js +++ b/addons/rose/addon/components/rose/anonymous.js @@ -6,5 +6,5 @@ import layout from '../../templates/components/rose/anonymous'; * that yield simple contextual components, such as layouts yielding regions. */ export default Component.extend({ - layout + layout, }); diff --git a/addons/rose/addon/components/rose/message.js b/addons/rose/addon/components/rose/message.js new file mode 100644 index 000000000..89ac42ee5 --- /dev/null +++ b/addons/rose/addon/components/rose/message.js @@ -0,0 +1,7 @@ +import Component from '@ember/component'; +import layout from '../../templates/components/rose/message'; + +export default Component.extend({ + layout, + tagName: '', +}); diff --git a/addons/rose/addon/components/rose/message.stories.mdx b/addons/rose/addon/components/rose/message.stories.mdx new file mode 100644 index 000000000..89447aca1 --- /dev/null +++ b/addons/rose/addon/components/rose/message.stories.mdx @@ -0,0 +1,84 @@ +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'; + + + +# Message + +A message component containing a title, description, and nav links. +Title can be configured with optional icon and subtitle. + + + {{ + template: hbs` + + + {{description}} + + + + Go back + + + Need help? + + + `, + context: { + title: text('title', 'Page not found'), + subtitle: text('subtitle', 'Error 404'), + description: text('description', 'Sorry, we could not find the page you were looking for. Navigate to another page with the links below.'), + icon: select( + 'icon', + { + 'alert-circle-outline': 'alert-circle-outline', + 'help-circle-outline': 'help-circle-outline', + 'disabled': 'disabled', + }, + 'help-circle-outline' + ), + }, + }} + + +```html + + + You must be granted permissions to view this data. Ask your administrator + if you think you should have access. + + + + Go back + + Need help? + +``` + +Message can be configured without icons and navigation links. + + + {{ + template: hbs` + + + {{description}} + + + `, + context: { + title: text('title', 'No logs received yet'), + description: text('description', 'Sorry, we could not find the page you were looking for. Navigate to another page with the links below.'), + }, + }} + + +```html + + + Description. + + +``` diff --git a/addons/rose/addon/styles/rose/_index.scss b/addons/rose/addon/styles/rose/_index.scss index b812b9f98..b3ddfcdd1 100644 --- a/addons/rose/addon/styles/rose/_index.scss +++ b/addons/rose/addon/styles/rose/_index.scss @@ -1,5 +1,4 @@ @import 'reset'; @import 'variables'; @import 'typography'; -@import 'icon'; @import 'components'; diff --git a/addons/rose/addon/styles/rose/_icon.scss b/addons/rose/addon/styles/rose/components/_icon.scss similarity index 89% rename from addons/rose/addon/styles/rose/_icon.scss rename to addons/rose/addon/styles/rose/components/_icon.scss index 08d4c6438..451af3823 100644 --- a/addons/rose/addon/styles/rose/_icon.scss +++ b/addons/rose/addon/styles/rose/components/_icon.scss @@ -1,4 +1,4 @@ -@use 'variables/sizing'; +@use '../variables/sizing'; .rose-icon { --size: #{sizing.rems(l)}; diff --git a/addons/rose/addon/styles/rose/components/_index.scss b/addons/rose/addon/styles/rose/components/_index.scss index f63f9bdf0..948a7b735 100644 --- a/addons/rose/addon/styles/rose/components/_index.scss +++ b/addons/rose/addon/styles/rose/components/_index.scss @@ -2,6 +2,7 @@ @import 'form'; @import 'header'; @import 'layout'; +@import 'icon'; @import 'notification'; @import 'card'; @import 'cards'; @@ -9,3 +10,4 @@ @import 'separator'; @import 'nav'; @import 'table'; +@import 'message'; diff --git a/addons/rose/addon/styles/rose/components/_message.scss b/addons/rose/addon/styles/rose/components/_message.scss new file mode 100644 index 000000000..7aa35e13c --- /dev/null +++ b/addons/rose/addon/styles/rose/components/_message.scss @@ -0,0 +1,78 @@ +@use '../utilities/type'; +@use '../variables/sizing'; +@use '../variables/media'; + +.rose-message { + --message-color: var(--ui-gray-starker-1); + display: flex; + flex-direction: column; + color: var(--message-color); + width: sizing.rems(l) * 15; //16 rems/320 px + margin-bottom: sizing.rems(l); + + // Icons always need tweaking + .rose-icon { + --size: #{sizing.rems(m)}; + > svg { + vertical-align: text-bottom; + } + } + + .rose-message-header { + display: grid; + grid-template-areas: + 'icon title' + 'icon subtitle'; + grid-auto-columns: auto 1fr; + margin-bottom: sizing.rems(m); + + .rose-icon { + // targeting 40px + --size: #{sizing.rems(xl) + sizing.rems(xxs)}; + grid-area: icon; + margin-right: sizing.rems(s); + } + + .rose-message-title { + @include type.type(l, semibold); + grid-area: title; + margin: 0; + } + + .rose-message-subtitle { + @include type.type(s, normal); + grid-area: subtitle; + margin: 0; + } + } + + .rose-message-body { + display: grid; + grid-template-areas: + 'description description' + 'left-link right-link'; + + .rose-message-description { + grid-area: description; + margin-bottom: sizing.rems(l); + } + + .rose-message-link { + @include type.type(s, semibold); + grid-area: left-link; + color: var(--action); + + text-decoration: none; + + & + .rose-message-link { + grid-area: right-link; + text-align: right; + color: var(--message-color); + } + + &:hover { + text-decoration: underline; + } + } + } +} diff --git a/addons/rose/addon/styles/rose/components/layout/_global.scss b/addons/rose/addon/styles/rose/components/layout/_global.scss index e6676017e..2100c70eb 100644 --- a/addons/rose/addon/styles/rose/components/layout/_global.scss +++ b/addons/rose/addon/styles/rose/components/layout/_global.scss @@ -23,7 +23,6 @@ grid-area: navigation; border-right: sizing.rems(xxxxs) solid var(--ui-border-subtler-1); } - } @media (max-width: media.width(small)) { diff --git a/addons/rose/addon/templates/components/rose/message.hbs b/addons/rose/addon/templates/components/rose/message.hbs new file mode 100644 index 000000000..1dd3157f0 --- /dev/null +++ b/addons/rose/addon/templates/components/rose/message.hbs @@ -0,0 +1,27 @@ +
+ + {{#if @title}} +
+ {{#if @icon}} + + {{/if}} + +

{{@title}}

+ + {{#if @subtitle}} +

{{@subtitle}}

+ {{/if}} +
+ {{/if}} + +
+ {{yield (hash + description=(component "rose/anonymous" tagName="p" class="rose-message-description") + link=(component "link-to" class="rose-message-link") + )}} +
+ +
diff --git a/addons/rose/app/components/rose/anonymous.js b/addons/rose/app/components/rose/anonymous.js index 56df9e7f7..5117bad96 100644 --- a/addons/rose/app/components/rose/anonymous.js +++ b/addons/rose/app/components/rose/anonymous.js @@ -1 +1 @@ -export { default } from 'rose/components/rose/anonymous'; \ No newline at end of file +export { default } from 'rose/components/rose/anonymous'; diff --git a/addons/rose/app/components/rose/message.js b/addons/rose/app/components/rose/message.js new file mode 100644 index 000000000..914d08e41 --- /dev/null +++ b/addons/rose/app/components/rose/message.js @@ -0,0 +1 @@ +export { default } from 'rose/components/rose/message'; diff --git a/addons/rose/tests/dummy/app/templates/index.hbs b/addons/rose/tests/dummy/app/templates/index.hbs index bb8ae24db..81a536a29 100644 --- a/addons/rose/tests/dummy/app/templates/index.hbs +++ b/addons/rose/tests/dummy/app/templates/index.hbs @@ -1,7 +1,46 @@ - - Level 1 - Level 2 - Level 3 - Level 4 - Level 5 - + + + You must be granted permissions to view this data. + Ask your administrator if you think you should have access. + + + + Go back + + Need help? + + + + + Sorry, we couldn't find the page you were looking for. You can go back or to one of the links below. + + + + Go back + + Need help? + + + + + We ran into a problem and could not continue. You can ask your administrator or try again later. + + + + Try Again + + Need help? + + + + + Your logs will appear here when we start receiving them. If your server is currently outputting logs, check your configuration. + + + + + + Namespaces allow you to create distinct areas with their own separate policies, mounts, tokens, and identity entities. + + Add a namespace + diff --git a/addons/rose/tests/dummy/app/templates/playground.hbs b/addons/rose/tests/dummy/app/templates/playground.hbs index 634ea800c..00b1c94cf 100644 --- a/addons/rose/tests/dummy/app/templates/playground.hbs +++ b/addons/rose/tests/dummy/app/templates/playground.hbs @@ -229,5 +229,13 @@ + + + Level 1 + Level 2 + Level 3 + Level 4 + Level 5 + diff --git a/addons/rose/tests/integration/components/rose/anonymous-test.js b/addons/rose/tests/integration/components/rose/anonymous-test.js index 01e171a52..d5b65eac0 100644 --- a/addons/rose/tests/integration/components/rose/anonymous-test.js +++ b/addons/rose/tests/integration/components/rose/anonymous-test.js @@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit'; import { render, find } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; -module('Integration | Component | rose/anonymous', function(hooks) { +module('Integration | Component | rose/anonymous', function (hooks) { setupRenderingTest(hooks); - test('it renders', async function(assert) { + test('it renders', async function (assert) { await render(hbs` {{#rose/anonymous tagName='main'}} template block text diff --git a/addons/rose/tests/integration/components/rose/message-test.js b/addons/rose/tests/integration/components/rose/message-test.js new file mode 100644 index 000000000..e14d74f2e --- /dev/null +++ b/addons/rose/tests/integration/components/rose/message-test.js @@ -0,0 +1,26 @@ +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/message', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + assert.expect(5); + await render(hbs` + + Description + Link + + `); + assert.ok(find('.rose-message')); + assert.equal(find('.rose-message-title').textContent.trim(), 'Title'); + assert.equal(find('.rose-message-subtitle').textContent.trim(), 'Subtitle'); + assert.equal( + find('.rose-message-description').textContent.trim(), + 'Description' + ); + assert.equal(find('.rose-message-link').textContent.trim(), 'Link'); + }); +});