1 parent
5e48fdaaf8
commit
42169b070c
5 files changed
+3
-173
No files matched your search
@@ -1,12 +0,0 @@
|
||||
<span
|
||||
...attributes
|
||||
class='rose-badge {{if @style (concat "rose-badge-" @style)}}'
|
||||
>
|
||||
{{#if @icon}}
|
||||
<Rose::Icon @name={{@icon}} @size='medium' />
|
||||
{{/if}}
|
||||
|
||||
<span class='rose-badge-body'>
|
||||
{{yield}}
|
||||
</span>
|
||||
</span>
|
||||
@@ -1,21 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { deprecate } from '@ember/debug';
|
||||
|
||||
export default class RoseBadgeComponent extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
deprecate(
|
||||
`Rose badge component is deprecated, use HDS Badge instead. For more info, refer to `,
|
||||
false,
|
||||
{
|
||||
id: 'rose.badge',
|
||||
until: '4.8.0',
|
||||
for: 'rose',
|
||||
since: {
|
||||
enabled: '3.28.8',
|
||||
},
|
||||
url: 'https://boundary-ui-storybook.vercel.app/?path=/docs/rose-badge--hds-badge',
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Meta, Story, Preview } from '@storybook/addon-docs';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
<Meta title="Rose/Badge" component="Badge" />
|
||||
<Meta title="Rose/Badge (removed)" component="Badge" />
|
||||
|
||||
# HDS Badge (Recommended)
|
||||
# Rose Badge (Removed)
|
||||
|
||||
> **_NOTE:_** Replaces the deprecated Rose/Badge.
|
||||
Rose/Badge has been removed in favor of [HDS::Badge](https://design-system-components-hashicorp.vercel.app/components/badge)
|
||||
|
||||
```handlebars
|
||||
<Hds::Badge @text='Success badge' @color='neutral' />
|
||||
@@ -36,86 +36,3 @@ export const HDSTemplate = (args) => ({
|
||||
{HDSTemplate.bind({})}
|
||||
</Story>
|
||||
</Preview>
|
||||
|
||||
# Rose Badge (Deprecated)
|
||||
|
||||
Rose/Badge has been deprecated in favor of [HDS::Badge](https://design-system-components-hashicorp.vercel.app/components/badge)
|
||||
|
||||
### <Rose::Badge> usage:
|
||||
|
||||
A badge component that supports icons and predefined styles.
|
||||
When style definition isn't supplied, a default style will be supplied.
|
||||
|
||||
Styles: outline, dark, informational, informational-outline, success, success-outline, error, error-outline, warning, warning-outline, alert, alert-outline
|
||||
|
||||
```handlebars
|
||||
<Rose::Badge
|
||||
@style='outline'
|
||||
@icon='flight-icons/svg/org-16'
|
||||
>Badge</Rose::Badge>
|
||||
```
|
||||
|
||||
export const Template = (args) => ({
|
||||
template: hbs`<Rose::Badge
|
||||
@style={{style}}
|
||||
@icon={{icon}}>
|
||||
{{text}}
|
||||
</Rose::Badge>`,
|
||||
context: args,
|
||||
});
|
||||
|
||||
<Preview>
|
||||
<Story
|
||||
name="Rose Badge"
|
||||
args={{
|
||||
text: 'Badge',
|
||||
style: 'none',
|
||||
icon: 'flight-icons/svg/org-16',
|
||||
}}
|
||||
argTypes={{
|
||||
style: {
|
||||
control: 'select',
|
||||
options: [
|
||||
'none',
|
||||
'outline',
|
||||
'dark',
|
||||
'informational',
|
||||
'informational-outline',
|
||||
'success',
|
||||
'success-outline',
|
||||
'alert',
|
||||
'alert-outline',
|
||||
'error',
|
||||
'error-outline',
|
||||
'warning',
|
||||
'warning-outline',
|
||||
],
|
||||
},
|
||||
}}
|
||||
>
|
||||
{Template.bind({})}
|
||||
</Story>
|
||||
</Preview>
|
||||
|
||||
<Preview>
|
||||
<Story name="Rose Badge Style legend">
|
||||
{{
|
||||
template: hbs`
|
||||
<Rose::Badge>default style</Rose::Badge>
|
||||
<Rose::Badge @style="outline">outline</Rose::Badge>
|
||||
<Rose::Badge @icon="flight-icons/svg/org-16">default style with icon</Rose::Badge>
|
||||
<Rose::Badge @style="dark">dark</Rose::Badge>
|
||||
<Rose::Badge @style="informational">informational</Rose::Badge>
|
||||
<Rose::Badge @style="informational-outline">informational-outline</Rose::Badge>
|
||||
<Rose::Badge @style="alert">alert</Rose::Badge>
|
||||
<Rose::Badge @style="alert-outline">alert-outline</Rose::Badge>
|
||||
<Rose::Badge @style="error">error</Rose::Badge>
|
||||
<Rose::Badge @style="error-outline">error-outline</Rose::Badge>
|
||||
<Rose::Badge @style="success">success</Rose::Badge>
|
||||
<Rose::Badge @style="success-outline">success-outline</Rose::Badge>
|
||||
<Rose::Badge @style="warning">warning</Rose::Badge>
|
||||
<Rose::Badge @style="warning-outline">warning-outline</Rose::Badge>
|
||||
`,
|
||||
}}
|
||||
</Story>
|
||||
</Preview>
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from 'rose/components/rose/badge';
|
||||
@@ -1,53 +0,0 @@
|
||||
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/badge', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test('it renders', async function (assert) {
|
||||
await render(hbs`<Rose::Badge />`);
|
||||
assert.ok(find('.rose-badge'));
|
||||
});
|
||||
|
||||
test('it renders with content', async function (assert) {
|
||||
await render(hbs`<Rose::Badge>host-catalog-1</Rose::Badge>`);
|
||||
assert.strictEqual(
|
||||
find('.rose-badge').textContent.trim(),
|
||||
'host-catalog-1'
|
||||
);
|
||||
});
|
||||
|
||||
test('it renders an icon using @icon', async function (assert) {
|
||||
await render(hbs`<Rose::Badge @icon="flight-icons/svg/entry-point-16" />`);
|
||||
assert.ok(find('.rose-icon'));
|
||||
});
|
||||
|
||||
test('it styles content using @style', async function (assert) {
|
||||
assert.expect(14);
|
||||
const styles = [
|
||||
'outline',
|
||||
'dark',
|
||||
'informational',
|
||||
'informational-outline',
|
||||
'alert',
|
||||
'alert-outline',
|
||||
'warning',
|
||||
'warning-outline',
|
||||
'error',
|
||||
'error-outline',
|
||||
'success',
|
||||
'success-outline',
|
||||
'warning',
|
||||
'warning-outline',
|
||||
];
|
||||
|
||||
await render(hbs`<Rose::Badge @style={{this.style}} />`);
|
||||
|
||||
styles.forEach((style) => {
|
||||
this.set('style', style);
|
||||
assert.ok(find(`.rose-badge-${style}`), `defines style: ${style}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user