Skip to content

Commit 18a7923

Browse files
committed
feat: Avatar component
1 parent 02a8daf commit 18a7923

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ScoutAvatar } from "@scouterna/ui-react";
2+
import preview from "#.storybook/preview";
3+
4+
const meta = preview.meta({
5+
title: "Basics/Avatar",
6+
component: ScoutAvatar,
7+
parameters: {
8+
layout: "centered",
9+
},
10+
});
11+
12+
export default meta;
13+
14+
export const BasicExample = meta.story({
15+
args: {},
16+
render: (args) => (
17+
<ScoutAvatar {...args} />
18+
),
19+
});
439 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:host {
2+
3+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Component, type ComponentInterface, h, Prop } from "@stencil/core";
2+
import { getAssetPath } from '@stencil/core';
3+
4+
@Component({
5+
tag: "scout-avatar",
6+
styleUrl: "avatar.css",
7+
shadow: {
8+
delegatesFocus: true,
9+
},
10+
assetsDirs: ['assets'],
11+
})
12+
export class ScoutAvatar implements ComponentInterface {
13+
14+
/**
15+
* The source URL of the user image.
16+
*/
17+
@Prop() imageSrc = '';
18+
19+
/**
20+
* The name of the user.
21+
*/
22+
@Prop() alt = '';
23+
24+
render() {
25+
26+
const fallback = getAssetPath('fallbackImage.png');
27+
console.log('Fallback asset path:', fallback);
28+
29+
return (
30+
<img src={getAssetPath('./assets/fallbackImage.png')} alt={this.alt} />
31+
);
32+
}
33+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# scout-avatar
2+
3+
<!-- Auto Generated Below -->
4+
5+
6+
## Properties
7+
8+
| Property | Attribute | Description | Type | Default |
9+
| ---------- | ----------- | --------------------------------- | -------- | ------- |
10+
| `alt` | `alt` | The name of the user. | `string` | `''` |
11+
| `imageSrc` | `image-src` | The source URL of the user image. | `string` | `''` |
12+
13+
14+
----------------------------------------------
15+
16+
*Built with [StencilJS](https://stenciljs.com/)*

0 commit comments

Comments
 (0)