@justeattakeaway/pie-thumbnail 0.4.0 → 0.5.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.
@@ -36,6 +36,14 @@
36
36
  },
37
37
  "default": "{\n default: 'c-thumbnail--backgroundDefault',\n subtle: 'c-thumbnail--backgroundSubtle',\n strong: 'c-thumbnail--backgroundStrong',\n dark: 'c-thumbnail--backgroundDark',\n inverse: 'c-thumbnail--backgroundInverse',\n 'inverse-alternative': 'c-thumbnail--backgroundInverseAlternative',\n}"
38
38
  },
39
+ {
40
+ "kind": "variable",
41
+ "name": "aspectRatios",
42
+ "type": {
43
+ "text": "['1by1', '4by3', '16by9']"
44
+ },
45
+ "default": "['1by1', '4by3', '16by9']"
46
+ },
39
47
  {
40
48
  "kind": "variable",
41
49
  "name": "sizes",
@@ -47,7 +55,7 @@
47
55
  "type": {
48
56
  "text": "DefaultProps"
49
57
  },
50
- "default": "{\n variant: 'default',\n size: 48,\n src: '',\n alt: '',\n disabled: false,\n hasPadding: false,\n backgroundColor: 'default',\n placeholder: {\n src: '',\n alt: '',\n },\n}"
58
+ "default": "{\n variant: 'default',\n size: 48,\n src: '',\n alt: '',\n disabled: false,\n hasPadding: false,\n backgroundColor: 'default',\n aspectRatio: '1by1',\n placeholder: {\n src: '',\n alt: '',\n },\n}"
51
59
  }
52
60
  ],
53
61
  "exports": [
@@ -75,6 +83,14 @@
75
83
  "module": "src/defs.js"
76
84
  }
77
85
  },
86
+ {
87
+ "kind": "js",
88
+ "name": "aspectRatios",
89
+ "declaration": {
90
+ "name": "aspectRatios",
91
+ "module": "src/defs.js"
92
+ }
93
+ },
78
94
  {
79
95
  "kind": "js",
80
96
  "name": "sizes",
@@ -114,6 +130,12 @@
114
130
  "privacy": "public",
115
131
  "attribute": "size"
116
132
  },
133
+ {
134
+ "kind": "field",
135
+ "name": "aspectRatio",
136
+ "privacy": "public",
137
+ "attribute": "aspectRatio"
138
+ },
117
139
  {
118
140
  "kind": "field",
119
141
  "name": "src",
@@ -169,7 +191,8 @@
169
191
  "type": {
170
192
  "text": "string"
171
193
  }
172
- }
194
+ },
195
+ "description": "Assigns the thumbnail size and border radius CSS variables\nbased on the size prop."
173
196
  },
174
197
  {
175
198
  "kind": "method",
@@ -193,6 +216,10 @@
193
216
  "name": "size",
194
217
  "fieldName": "size"
195
218
  },
219
+ {
220
+ "name": "aspectRatio",
221
+ "fieldName": "aspectRatio"
222
+ },
196
223
  {
197
224
  "name": "src",
198
225
  "fieldName": "src"
package/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ import type { CSSResult } from 'lit';
3
3
  import type { LitElement } from 'lit';
4
4
  import type { TemplateResult } from 'lit-html';
5
5
 
6
+ export declare const aspectRatios: readonly ["1by1", "4by3", "16by9"];
7
+
6
8
  export declare const backgroundColorClassNames: Record<typeof backgroundColors[number], string>;
7
9
 
8
10
  export declare const backgroundColors: readonly ["default", "subtle", "strong", "dark", "inverse", "inverse-alternative"];
@@ -17,6 +19,7 @@ export declare const defaultProps: DefaultProps;
17
19
  export declare class PieThumbnail extends LitElement implements ThumbnailProps {
18
20
  variant: "default" | "outline";
19
21
  size: number;
22
+ aspectRatio: "1by1" | "4by3" | "16by9";
20
23
  src: string;
21
24
  alt: string;
22
25
  disabled: boolean;
@@ -24,6 +27,10 @@ export declare class PieThumbnail extends LitElement implements ThumbnailProps {
24
27
  backgroundColor: "default" | "subtle" | "strong" | "dark" | "inverse" | "inverse-alternative";
25
28
  placeholder: ThumbnailProps['placeholder'];
26
29
  private img;
30
+ /**
31
+ * Assigns the thumbnail size and border radius CSS variables
32
+ * based on the size prop.
33
+ */
27
34
  private _generateSizeStyles;
28
35
  /**
29
36
  * Handles image load errors by replacing the src and alt props
@@ -80,6 +87,10 @@ export declare interface ThumbnailProps {
80
87
  * What placeholder should be used when the image fails to load.
81
88
  */
82
89
  placeholder?: PlaceholderProps;
90
+ /**
91
+ * Sets the aspect-ratio of the thumbnail image.
92
+ */
93
+ aspectRatio?: typeof aspectRatios[number];
83
94
  }
84
95
 
85
96
  export declare const variants: readonly ["default", "outline"];
package/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
- import { LitElement as f, html as y, unsafeCSS as k } from "lit";
2
- import { validPropertyValues as b, defineCustomElement as S } from "@justeattakeaway/pie-webc-core";
3
- import { classMap as z } from "lit/directives/class-map.js";
4
- import { property as o, query as _ } from "lit/decorators.js";
5
- const C = [
1
+ import { LitElement as f, html as k, unsafeCSS as S } from "lit";
2
+ import { validPropertyValues as d, defineCustomElement as z } from "@justeattakeaway/pie-webc-core";
3
+ import { classMap as _ } from "lit/directives/class-map.js";
4
+ import { property as n, query as C } from "lit/decorators.js";
5
+ const E = [
6
6
  "default",
7
7
  "outline"
8
- ], E = [
8
+ ], I = [
9
9
  "default",
10
10
  "subtle",
11
11
  "strong",
12
12
  "dark",
13
13
  "inverse",
14
14
  "inverse-alternative"
15
- ], I = {
15
+ ], R = {
16
16
  default: "c-thumbnail--backgroundDefault",
17
17
  subtle: "c-thumbnail--backgroundSubtle",
18
18
  strong: "c-thumbnail--backgroundStrong",
19
19
  dark: "c-thumbnail--backgroundDark",
20
20
  inverse: "c-thumbnail--backgroundInverse",
21
21
  "inverse-alternative": "c-thumbnail--backgroundInverseAlternative"
22
- }, m = 8, g = 24, x = 128, $ = Object.freeze(Array.from(
23
- { length: (x - g) / m + 1 },
24
- (c, t) => g + t * m
25
- )), e = {
22
+ }, $ = ["1by1", "4by3", "16by9"], m = 8, p = 24, x = 128, P = Object.freeze(Array.from(
23
+ { length: (x - p) / m + 1 },
24
+ (u, t) => p + t * m
25
+ )), r = {
26
26
  variant: "default",
27
27
  size: 48,
28
28
  src: "",
@@ -30,26 +30,31 @@ const C = [
30
30
  disabled: !1,
31
31
  hasPadding: !1,
32
32
  backgroundColor: "default",
33
+ aspectRatio: "1by1",
33
34
  placeholder: {
34
35
  src: "",
35
36
  alt: ""
36
37
  }
37
- }, P = ".c-thumbnail{--thumbnail-size: 48px;--thumbnail-border-radius: var(--dt-radius-rounded-b);--thumbnail-bg-color: var(--dt-color-container-default);--thumbnail-border-color: transparent;--thumbnail-padding: calc(var(--dt-spacing-a) / 2);display:flex;justify-content:center;align-items:center;box-sizing:border-box;overflow:hidden;width:var(--thumbnail-size);height:var(--thumbnail-size);border-radius:var(--thumbnail-border-radius);border:1px solid var(--thumbnail-border-color);background-color:var(--thumbnail-bg-color)}.c-thumbnail.c-thumbnail--outline{--thumbnail-border-color: var(--dt-color-border-default)}.c-thumbnail.c-thumbnail--disabled{opacity:.5}.c-thumbnail.c-thumbnail--backgroundSubtle{--thumbnail-bg-color: var(--dt-color-container-subtle)}.c-thumbnail.c-thumbnail--backgroundStrong{--thumbnail-bg-color: var(--dt-color-container-strong)}.c-thumbnail.c-thumbnail--backgroundDark{--thumbnail-bg-color: var(--dt-color-container-dark)}.c-thumbnail.c-thumbnail--backgroundInverse{--thumbnail-bg-color: var(--dt-color-container-inverse)}.c-thumbnail.c-thumbnail--backgroundInverseAlternative{--thumbnail-bg-color: var(--dt-color-container-inverse-alternative)}.c-thumbnail.c-thumbnail--padding{padding:var(--thumbnail-padding)}.c-thumbnail .c-thumbnail-img{width:100%;height:auto}";
38
- var A = Object.defineProperty, i = (c, t, r, u) => {
39
- for (var n = void 0, l = c.length - 1, s; l >= 0; l--)
40
- (s = c[l]) && (n = s(t, r, n) || n);
41
- return n && A(t, r, n), n;
38
+ }, A = ".c-thumbnail{--thumbnail-size: 48px;--thumbnail-border-radius: var(--dt-radius-rounded-b);--thumbnail-bg-color: var(--dt-color-container-default);--thumbnail-padding: calc(var(--dt-spacing-a) / 2);--thumbnail-img-border-radius: unset;display:flex;justify-content:center;align-items:center;box-sizing:border-box;overflow:hidden;width:var(--thumbnail-size);height:var(--thumbnail-size);border-radius:var(--thumbnail-border-radius);background-color:var(--thumbnail-bg-color)}.c-thumbnail.c-thumbnail--outline{border:1px solid var(--dt-color-border-default)}.c-thumbnail.c-thumbnail--disabled{opacity:.5}.c-thumbnail.c-thumbnail--backgroundSubtle{--thumbnail-bg-color: var(--dt-color-container-subtle)}.c-thumbnail.c-thumbnail--backgroundStrong{--thumbnail-bg-color: var(--dt-color-container-strong)}.c-thumbnail.c-thumbnail--backgroundDark{--thumbnail-bg-color: var(--dt-color-container-dark)}.c-thumbnail.c-thumbnail--backgroundInverse{--thumbnail-bg-color: var(--dt-color-container-inverse)}.c-thumbnail.c-thumbnail--backgroundInverseAlternative{--thumbnail-bg-color: var(--dt-color-container-inverse-alternative)}.c-thumbnail.c-thumbnail--padding{--thumbnail-img-border-radius: calc(var(--thumbnail-border-radius) - var(--thumbnail-padding));padding:var(--thumbnail-padding)}.c-thumbnail.c-thumbnail--4by3{height:calc(var(--thumbnail-size) * 3 / 4)}.c-thumbnail.c-thumbnail--16by9{height:calc(var(--thumbnail-size) * 9 / 16)}.c-thumbnail .c-thumbnail-img{width:100%;height:100%;border-radius:var(--thumbnail-img-border-radius);object-fit:cover}";
39
+ var j = Object.defineProperty, i = (u, t, a, b) => {
40
+ for (var o = void 0, l = u.length - 1, c; l >= 0; l--)
41
+ (c = u[l]) && (o = c(t, a, o) || o);
42
+ return o && j(t, a, o), o;
42
43
  };
43
- const d = "pie-thumbnail", h = class h extends f {
44
+ const s = "pie-thumbnail", h = class h extends f {
44
45
  constructor() {
45
- super(...arguments), this.variant = e.variant, this.size = e.size, this.src = e.src, this.alt = e.alt, this.disabled = e.disabled, this.hasPadding = e.hasPadding, this.backgroundColor = e.backgroundColor, this.placeholder = e.placeholder;
46
+ super(...arguments), this.variant = r.variant, this.size = r.size, this.aspectRatio = r.aspectRatio, this.src = r.src, this.alt = r.alt, this.disabled = r.disabled, this.hasPadding = r.hasPadding, this.backgroundColor = r.backgroundColor, this.placeholder = r.placeholder;
46
47
  }
48
+ /**
49
+ * Assigns the thumbnail size and border radius CSS variables
50
+ * based on the size prop.
51
+ */
47
52
  _generateSizeStyles() {
48
53
  const { size: t } = this;
49
- let r = "--dt-radius-rounded-c";
50
- return t <= 40 ? r = "--dt-radius-rounded-a" : t <= 56 && (r = "--dt-radius-rounded-b"), `
54
+ let a = "--dt-radius-rounded-c";
55
+ return t <= 40 ? a = "--dt-radius-rounded-a" : t <= 56 && (a = "--dt-radius-rounded-b"), `
51
56
  --thumbnail-size: ${t}px;
52
- --thumbnail-border-radius: var(${r});
57
+ --thumbnail-border-radius: var(${a});
53
58
  `;
54
59
  }
55
60
  /**
@@ -57,8 +62,8 @@ const d = "pie-thumbnail", h = class h extends f {
57
62
  * with the placeholder props.
58
63
  */
59
64
  _handleImageError() {
60
- var t, r;
61
- (t = this.placeholder) != null && t.src && this.setAttribute("src", this.placeholder.src), (r = this.placeholder) != null && r.alt && this.setAttribute("alt", this.placeholder.alt);
65
+ var t, a;
66
+ (t = this.placeholder) != null && t.src && this.setAttribute("src", this.placeholder.src), (a = this.placeholder) != null && a.alt && this.setAttribute("alt", this.placeholder.alt);
62
67
  }
63
68
  /**
64
69
  * Detects image load status and applies the placeholder on failure.
@@ -66,8 +71,8 @@ const d = "pie-thumbnail", h = class h extends f {
66
71
  */
67
72
  _checkImageError() {
68
73
  if (this.img) {
69
- const { complete: t, naturalHeight: r } = this.img;
70
- t && r === 0 && this._handleImageError.call(this);
74
+ const { complete: t, naturalHeight: a } = this.img;
75
+ t && a === 0 && this._handleImageError.call(this);
71
76
  }
72
77
  }
73
78
  firstUpdated() {
@@ -76,71 +81,78 @@ const d = "pie-thumbnail", h = class h extends f {
76
81
  render() {
77
82
  const {
78
83
  variant: t,
79
- src: r,
80
- alt: u,
81
- disabled: n,
84
+ src: a,
85
+ alt: b,
86
+ disabled: o,
82
87
  hasPadding: l,
83
- backgroundColor: s
84
- } = this, p = {
88
+ backgroundColor: c,
89
+ aspectRatio: g
90
+ } = this, v = {
85
91
  "c-thumbnail": !0,
86
92
  [`c-thumbnail--${t}`]: !0,
87
- [I[s]]: !0,
88
- "c-thumbnail--disabled": n,
93
+ [`c-thumbnail--${g}`]: !0,
94
+ [R[c]]: !0,
95
+ "c-thumbnail--disabled": o,
89
96
  "c-thumbnail--padding": l
90
- }, v = this._generateSizeStyles();
91
- return y`
97
+ }, y = this._generateSizeStyles();
98
+ return k`
92
99
  <div data-test-id="pie-thumbnail"
93
- class="${z(p)}"
94
- style="${v}">
100
+ class="${_(v)}"
101
+ style="${y}">
95
102
  <img
96
103
  data-test-id="pie-thumbnail-img"
97
- src="${r}"
104
+ src="${a}"
98
105
  class="c-thumbnail-img"
99
- alt="${u}"
106
+ alt="${b}"
100
107
  @error="${this._handleImageError}"
101
108
  />
102
109
  </div>
103
110
  `;
104
111
  }
105
112
  };
106
- h.styles = k(P);
107
- let a = h;
113
+ h.styles = S(A);
114
+ let e = h;
115
+ i([
116
+ n({ type: String }),
117
+ d(s, E, r.variant)
118
+ ], e.prototype, "variant");
108
119
  i([
109
- o({ type: String }),
110
- b(d, C, e.variant)
111
- ], a.prototype, "variant");
120
+ n({ type: Number }),
121
+ d(s, P, r.size)
122
+ ], e.prototype, "size");
112
123
  i([
113
- o({ type: Number }),
114
- b(d, $, e.size)
115
- ], a.prototype, "size");
124
+ n({ type: String }),
125
+ d(s, $, r.aspectRatio)
126
+ ], e.prototype, "aspectRatio");
116
127
  i([
117
- o({ type: String })
118
- ], a.prototype, "src");
128
+ n({ type: String })
129
+ ], e.prototype, "src");
119
130
  i([
120
- o({ type: String })
121
- ], a.prototype, "alt");
131
+ n({ type: String })
132
+ ], e.prototype, "alt");
122
133
  i([
123
- o({ type: Boolean })
124
- ], a.prototype, "disabled");
134
+ n({ type: Boolean })
135
+ ], e.prototype, "disabled");
125
136
  i([
126
- o({ type: Boolean })
127
- ], a.prototype, "hasPadding");
137
+ n({ type: Boolean })
138
+ ], e.prototype, "hasPadding");
128
139
  i([
129
- o({ type: String }),
130
- b(d, E, e.backgroundColor)
131
- ], a.prototype, "backgroundColor");
140
+ n({ type: String }),
141
+ d(s, I, r.backgroundColor)
142
+ ], e.prototype, "backgroundColor");
132
143
  i([
133
- o({ type: Object })
134
- ], a.prototype, "placeholder");
144
+ n({ type: Object })
145
+ ], e.prototype, "placeholder");
135
146
  i([
136
- _("img")
137
- ], a.prototype, "img");
138
- S(d, a);
147
+ C("img")
148
+ ], e.prototype, "img");
149
+ z(s, e);
139
150
  export {
140
- a as PieThumbnail,
141
- I as backgroundColorClassNames,
142
- E as backgroundColors,
143
- e as defaultProps,
144
- $ as sizes,
145
- C as variants
151
+ e as PieThumbnail,
152
+ $ as aspectRatios,
153
+ R as backgroundColorClassNames,
154
+ I as backgroundColors,
155
+ r as defaultProps,
156
+ P as sizes,
157
+ E as variants
146
158
  };
package/dist/react.d.ts CHANGED
@@ -4,6 +4,8 @@ import type { LitElement } from 'lit';
4
4
  import * as React_2 from 'react';
5
5
  import type { TemplateResult } from 'lit-html';
6
6
 
7
+ export declare const aspectRatios: readonly ["1by1", "4by3", "16by9"];
8
+
7
9
  export declare const backgroundColorClassNames: Record<typeof backgroundColors[number], string>;
8
10
 
9
11
  export declare const backgroundColors: readonly ["default", "subtle", "strong", "dark", "inverse", "inverse-alternative"];
@@ -20,6 +22,7 @@ export declare const PieThumbnail: React_2.ForwardRefExoticComponent<ThumbnailPr
20
22
  declare class PieThumbnail_2 extends LitElement implements ThumbnailProps {
21
23
  variant: "default" | "outline";
22
24
  size: number;
25
+ aspectRatio: "1by1" | "4by3" | "16by9";
23
26
  src: string;
24
27
  alt: string;
25
28
  disabled: boolean;
@@ -27,6 +30,10 @@ declare class PieThumbnail_2 extends LitElement implements ThumbnailProps {
27
30
  backgroundColor: "default" | "subtle" | "strong" | "dark" | "inverse" | "inverse-alternative";
28
31
  placeholder: ThumbnailProps['placeholder'];
29
32
  private img;
33
+ /**
34
+ * Assigns the thumbnail size and border radius CSS variables
35
+ * based on the size prop.
36
+ */
30
37
  private _generateSizeStyles;
31
38
  /**
32
39
  * Handles image load errors by replacing the src and alt props
@@ -85,6 +92,10 @@ export declare interface ThumbnailProps {
85
92
  * What placeholder should be used when the image fails to load.
86
93
  */
87
94
  placeholder?: PlaceholderProps;
95
+ /**
96
+ * Sets the aspect-ratio of the thumbnail image.
97
+ */
98
+ aspectRatio?: typeof aspectRatios[number];
88
99
  }
89
100
 
90
101
  export declare const variants: readonly ["default", "outline"];
package/dist/react.js CHANGED
@@ -1,19 +1,20 @@
1
1
  import * as a from "react";
2
2
  import { createComponent as e } from "@lit/react";
3
3
  import { PieThumbnail as o } from "./index.js";
4
- import { backgroundColorClassNames as l, backgroundColors as p, defaultProps as u, sizes as b, variants as c } from "./index.js";
5
- const i = e({
4
+ import { aspectRatios as l, backgroundColorClassNames as p, backgroundColors as c, defaultProps as u, sizes as b, variants as h } from "./index.js";
5
+ const t = e({
6
6
  displayName: "PieThumbnail",
7
7
  elementClass: o,
8
8
  react: a,
9
9
  tagName: "pie-thumbnail",
10
10
  events: {}
11
- }), r = i;
11
+ }), s = t;
12
12
  export {
13
- r as PieThumbnail,
14
- l as backgroundColorClassNames,
15
- p as backgroundColors,
13
+ s as PieThumbnail,
14
+ l as aspectRatios,
15
+ p as backgroundColorClassNames,
16
+ c as backgroundColors,
16
17
  u as defaultProps,
17
18
  b as sizes,
18
- c as variants
19
+ h as variants
19
20
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-thumbnail",
3
3
  "description": "PIE Design System Thumbnail built using Web Components",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
package/src/defs.ts CHANGED
@@ -17,6 +17,8 @@ export const backgroundColorClassNames: Record<typeof backgroundColors[number],
17
17
  'inverse-alternative': 'c-thumbnail--backgroundInverseAlternative',
18
18
  };
19
19
 
20
+ export const aspectRatios = ['1by1', '4by3', '16by9'] as const;
21
+
20
22
  const SIZE_INCREMENT_BY = 8;
21
23
  const SIZE_MIN = 24;
22
24
  const SIZE_MAX = 128;
@@ -64,6 +66,10 @@ export interface ThumbnailProps {
64
66
  * What placeholder should be used when the image fails to load.
65
67
  */
66
68
  placeholder?: PlaceholderProps;
69
+ /**
70
+ * Sets the aspect-ratio of the thumbnail image.
71
+ */
72
+ aspectRatio?: typeof aspectRatios[number];
67
73
  }
68
74
 
69
75
  export type DefaultProps = ComponentDefaultProps<ThumbnailProps>;
@@ -76,6 +82,7 @@ export const defaultProps: DefaultProps = {
76
82
  disabled: false,
77
83
  hasPadding: false,
78
84
  backgroundColor: 'default',
85
+ aspectRatio: '1by1',
79
86
  placeholder: {
80
87
  src: '',
81
88
  alt: '',
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  backgroundColors,
14
14
  backgroundColorClassNames,
15
15
  sizes,
16
+ aspectRatios,
16
17
  } from './defs';
17
18
  import styles from './thumbnail.scss?inline';
18
19
 
@@ -33,6 +34,10 @@ export class PieThumbnail extends LitElement implements ThumbnailProps {
33
34
  @validPropertyValues(componentSelector, sizes, defaultProps.size)
34
35
  public size = defaultProps.size;
35
36
 
37
+ @property({ type: String })
38
+ @validPropertyValues(componentSelector, aspectRatios, defaultProps.aspectRatio)
39
+ public aspectRatio = defaultProps.aspectRatio;
40
+
36
41
  @property({ type: String })
37
42
  public src = defaultProps.src;
38
43
 
@@ -55,6 +60,10 @@ export class PieThumbnail extends LitElement implements ThumbnailProps {
55
60
  @query('img')
56
61
  private img!: HTMLImageElement;
57
62
 
63
+ /**
64
+ * Assigns the thumbnail size and border radius CSS variables
65
+ * based on the size prop.
66
+ */
58
67
  private _generateSizeStyles (): string {
59
68
  const { size } = this;
60
69
  let borderRadius = '--dt-radius-rounded-c';
@@ -103,11 +112,13 @@ export class PieThumbnail extends LitElement implements ThumbnailProps {
103
112
  disabled,
104
113
  hasPadding,
105
114
  backgroundColor,
115
+ aspectRatio,
106
116
  } = this;
107
117
 
108
118
  const wrapperClasses = {
109
119
  'c-thumbnail': true,
110
120
  [`c-thumbnail--${variant}`]: true,
121
+ [`c-thumbnail--${aspectRatio}`]: true,
111
122
  [backgroundColorClassNames[backgroundColor]]: true,
112
123
  'c-thumbnail--disabled': disabled,
113
124
  'c-thumbnail--padding': hasPadding,
@@ -2,8 +2,8 @@
2
2
  --thumbnail-size: 48px;
3
3
  --thumbnail-border-radius: var(--dt-radius-rounded-b);
4
4
  --thumbnail-bg-color: var(--dt-color-container-default);
5
- --thumbnail-border-color: transparent;
6
5
  --thumbnail-padding: calc(var(--dt-spacing-a) / 2);
6
+ --thumbnail-img-border-radius: unset;
7
7
 
8
8
  display: flex;
9
9
  justify-content: center;
@@ -13,11 +13,10 @@
13
13
  width: var(--thumbnail-size);
14
14
  height: var(--thumbnail-size);
15
15
  border-radius: var(--thumbnail-border-radius);
16
- border: 1px solid var(--thumbnail-border-color);
17
16
  background-color: var(--thumbnail-bg-color);
18
17
 
19
18
  &.c-thumbnail--outline {
20
- --thumbnail-border-color: var(--dt-color-border-default);
19
+ border: 1px solid var(--dt-color-border-default);
21
20
  }
22
21
 
23
22
  &.c-thumbnail--disabled {
@@ -45,11 +44,22 @@
45
44
  }
46
45
 
47
46
  &.c-thumbnail--padding {
47
+ --thumbnail-img-border-radius: calc(var(--thumbnail-border-radius) - var(--thumbnail-padding));
48
48
  padding: var(--thumbnail-padding);
49
49
  }
50
50
 
51
+ &.c-thumbnail--4by3 {
52
+ height: calc(var(--thumbnail-size) * 3 / 4)
53
+ }
54
+
55
+ &.c-thumbnail--16by9 {
56
+ height: calc(var(--thumbnail-size) * 9 / 16)
57
+ }
58
+
51
59
  .c-thumbnail-img {
52
60
  width: 100%;
53
- height: auto;
61
+ height: 100%;
62
+ border-radius: var(--thumbnail-img-border-radius);
63
+ object-fit: cover;
54
64
  }
55
65
  }