chore: 🤖 Add card link component to rose addon
This commit is contained in:
9 files changed
+173
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import Component from '@ember/component';
|
||||
import layout from '../../../templates/components/rose/card/link';
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: '',
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Meta, Story, Preview } from '@storybook/addon-docs/blocks';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
import { text } from '@storybook/addon-knobs';
|
||||
|
||||
<Meta title="Rose|Card|Link" component="Link" />
|
||||
|
||||
# Card Link
|
||||
|
||||
Card link component wraps content with `LinkTo` component. Supports title and description.
|
||||
|
||||
```html
|
||||
<Rose::Card::Link @title='Card title' @description='Card description' @route='about'/>
|
||||
```
|
||||
|
||||
<Preview>
|
||||
<Story name="Basic">{{
|
||||
template: hbs`
|
||||
<Rose::Card::Link
|
||||
@title={{title}}
|
||||
@description={{description}}
|
||||
/>
|
||||
`,
|
||||
context: {
|
||||
title: text('title', 'Card title'),
|
||||
description: text('description', 'Card description'),
|
||||
},
|
||||
}}</Story>
|
||||
</Preview>
|
||||
|
||||
`@route` defaults to 'index' when not supplied.
|
||||
|
||||
`@title` and `@description` are optional. Card expands to fit content.
|
||||
|
||||
```html
|
||||
<Rose::Card::Link @title='Card title'/>
|
||||
```
|
||||
<Preview>
|
||||
<Story name="Title">{{
|
||||
template: hbs`
|
||||
<Rose::Card::Link @title={{title}} />
|
||||
`,
|
||||
context: {
|
||||
title: text('title', 'Card title'),
|
||||
},
|
||||
}}</Story>
|
||||
</Preview>
|
||||
|
||||
```html
|
||||
<Rose::Card::Link @description='Card description'/>
|
||||
```
|
||||
<Preview>
|
||||
<Story name="Description">{{
|
||||
template: hbs`
|
||||
<Rose::Card::Link @description={{description}} />
|
||||
`,
|
||||
context: {
|
||||
description: text('description', 'Card description'),
|
||||
},
|
||||
}}</Story>
|
||||
</Preview>
|
||||
@@ -3,3 +3,4 @@
|
||||
@import 'header';
|
||||
@import 'layout';
|
||||
@import 'notification';
|
||||
@import 'card';
|
||||
@@ -0,0 +1 @@
|
||||
@import 'link';
|
||||
@@ -0,0 +1,40 @@
|
||||
@use '../../variables/sizing';
|
||||
@use '../../utilities/type';
|
||||
|
||||
.rose-card-link {
|
||||
@include type.type(s);
|
||||
border: 1px solid var(--ui-gray-subtler-2);
|
||||
border-radius: sizing.rems(xxxs);
|
||||
color: var(--ui-gray);
|
||||
padding: sizing.rems(s);
|
||||
display: inline-grid;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--ui-gray);
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
border-color: var(--info);
|
||||
}
|
||||
|
||||
.rose-card-link-title {
|
||||
@include type.type(m, semibold);
|
||||
color: var(--stark);
|
||||
margin: 0;
|
||||
padding-bottom: sizing.rems(xs);
|
||||
}
|
||||
|
||||
.rose-card-link-description {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<article ...attributes class="rose-card-link">
|
||||
<LinkTo
|
||||
title={{@title}}
|
||||
@route={{if @route @route "index"}}
|
||||
>
|
||||
|
||||
{{#if @title}}
|
||||
<h2 class="rose-card-link-title">{{@title}}</h2>
|
||||
{{/if}}
|
||||
|
||||
{{#if @description}}
|
||||
<p class="rose-card-link-description">{{@description}}</p>
|
||||
{{/if}}
|
||||
</LinkTo>
|
||||
|
||||
{{yield}}
|
||||
</article>
|
||||
Reference in new issue
Block a user