@1024pix/pix-ui 60.9.0 → 60.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { warn } from '@ember/debug';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
|
|
4
|
+
import PixBlock from './pix-block';
|
|
5
|
+
|
|
6
|
+
export default class PixCard extends Component {
|
|
7
|
+
static get variants() {
|
|
8
|
+
return ['primary', 'admin', 'orga', 'certif'];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get variant() {
|
|
12
|
+
const value = this.args.variant ?? 'orga';
|
|
13
|
+
warn(
|
|
14
|
+
`PixCard: @variant "${value}" should be ${PixCard.variants.join(', ')}`,
|
|
15
|
+
PixCard.variants.includes(value),
|
|
16
|
+
{
|
|
17
|
+
id: 'pix-ui.pix-card.variant.not-valid',
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
<template>
|
|
24
|
+
<PixBlock @variant={{this.variant}} class="pix-card-wrapper">
|
|
25
|
+
<article class="pix-card">
|
|
26
|
+
{{#if @image}}
|
|
27
|
+
<div class="pix-card__image pix-card__image--{{this.variant}}">
|
|
28
|
+
<img src={{@image}} aria-hidden="true" alt="" />
|
|
29
|
+
</div>
|
|
30
|
+
{{/if}}
|
|
31
|
+
{{#if (has-block "tag")}}
|
|
32
|
+
{{yield to="tag"}}
|
|
33
|
+
{{/if}}
|
|
34
|
+
<div class="pix-card__content">
|
|
35
|
+
<header>
|
|
36
|
+
<h3 class="pix-card__title pix-title-xs" title={{@title}}>{{@title}}</h3>
|
|
37
|
+
{{#if @subtitle}}
|
|
38
|
+
<p title={{@subtitle}} class="pix-card__subtitle pix-subtitle-xs">
|
|
39
|
+
{{@subtitle}}
|
|
40
|
+
</p>
|
|
41
|
+
{{/if}}
|
|
42
|
+
</header>
|
|
43
|
+
{{#if (has-block "description")}}
|
|
44
|
+
<div class="pix-card__description pix-body-s">{{yield to="description"}}</div>
|
|
45
|
+
{{/if}}
|
|
46
|
+
{{#if (has-block "footer")}}
|
|
47
|
+
<footer class="pix-card__footer pix-body-xs">{{yield to="footer"}}</footer>
|
|
48
|
+
{{/if}}
|
|
49
|
+
</div>
|
|
50
|
+
</article>
|
|
51
|
+
</PixBlock>
|
|
52
|
+
</template>
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.pix-card-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.pix-card {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--pix-spacing-3x);
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
|
|
11
|
+
&__image {
|
|
12
|
+
width: 76px;
|
|
13
|
+
height: 76px;
|
|
14
|
+
border-radius: var(--radius-3x, 12px);
|
|
15
|
+
|
|
16
|
+
img {
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--orga {
|
|
21
|
+
background: var(--pix-orga-50);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__content {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
flex-grow: 1;
|
|
29
|
+
gap: var(--pix-spacing-2x);
|
|
30
|
+
color: var(--pix-neutral-900);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&__title {
|
|
34
|
+
display: -webkit-box;
|
|
35
|
+
align-self: stretch;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
-webkit-box-orient: vertical;
|
|
38
|
+
-webkit-line-clamp: 2;
|
|
39
|
+
line-clamp: 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__subtitle {
|
|
43
|
+
align-self: stretch;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
text-overflow: ellipsis;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__footer {
|
|
50
|
+
margin-top: auto;
|
|
51
|
+
color: var(--pix-neutral-500);
|
|
52
|
+
}
|
|
53
|
+
}
|
package/addon/styles/addon.scss
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-card';
|