Skip to content

Commit 5cdc562

Browse files
committed
add SfThumbnail
1 parent 2dd96cd commit 5cdc562

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Slot, component$ } from '@builder.io/qwik';
2+
import { SfThumbnailSize } from '../../shared/SfThumbnail';
3+
import { SfThumbnailProps } from './types';
4+
5+
const sizeClasses = {
6+
[SfThumbnailSize.sm]: 'w-5 h-5',
7+
[SfThumbnailSize.base]: 'w-6 h-6',
8+
[SfThumbnailSize.lg]: 'w-10 h-10',
9+
[SfThumbnailSize.xl]: 'w-14 h-14',
10+
};
11+
export const SfThumbnail = component$<SfThumbnailProps>(
12+
({ size = SfThumbnailSize.base, class: _class, ...attributes }) => {
13+
return (
14+
<div
15+
class={[
16+
'rounded-full overflow-hidden bg-clip-content p-0.5',
17+
sizeClasses[size],
18+
_class,
19+
]}
20+
data-testid="thumbnail"
21+
{...attributes}
22+
>
23+
<Slot />
24+
</div>
25+
);
26+
}
27+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './types';
2+
3+
export { SfThumbnail } from './SfThumbnail';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { SfThumbnailSize } from '../../shared/SfThumbnail';
2+
3+
export type SfThumbnailProps = {
4+
class: string;
5+
size?: `${SfThumbnailSize}`;
6+
};

0 commit comments

Comments
 (0)