Compare commits
2 Commits
b61720fd24
...
03a92db05e
| Author | SHA1 | Date | |
|---|---|---|---|
| 03a92db05e | |||
| 7c65e70c8f |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@unkn0wndo3s/nova-design-system",
|
"name": "@unkn0wndo3s/nova-design-system",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.03.0",
|
"version": "0.04.0",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"description": "Nova Design System — Astro component library",
|
"description": "Nova Design System — Astro component library",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
@use '../../styles/tokens/typography' as *;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
&__content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
@include text-base;
|
||||||
|
color: var(--nds-color-on-primary);
|
||||||
|
background-color: var(--nds-disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
import { ProfileIcon } from '../Icons';
|
||||||
|
export interface Props {
|
||||||
|
type: 'photo' | 'initials';
|
||||||
|
name: string;
|
||||||
|
image?: string;
|
||||||
|
}
|
||||||
|
const { type, name, image } = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class={`avatar`}>
|
||||||
|
{type === 'photo' && image ? (
|
||||||
|
<div class="avatar__content avatar__content--photo">
|
||||||
|
<img
|
||||||
|
src={image}
|
||||||
|
alt={name}
|
||||||
|
class="avatar__content"
|
||||||
|
onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';"
|
||||||
|
/>
|
||||||
|
<span class="avatar__fallback" style="display:none;">
|
||||||
|
<ProfileIcon size={24}/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<span class="avatar__content">{name.split(' ').map(word => word[0]).join('').toUpperCase()}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@use './_avatar.scss';
|
||||||
|
</style>
|
||||||
@@ -13,3 +13,4 @@ export { default as ListItemTitle } from './ListItem/listItemTitle.astro';
|
|||||||
export { default as ListItemSubtitle } from './ListItem/listItemSubtitle.astro';
|
export { default as ListItemSubtitle } from './ListItem/listItemSubtitle.astro';
|
||||||
export { default as LoadingBar } from './LoadingBar/loadingBar.astro';
|
export { default as LoadingBar } from './LoadingBar/loadingBar.astro';
|
||||||
export { default as NumericStepper } from './numericStepper/numericStepper.astro';
|
export { default as NumericStepper } from './numericStepper/numericStepper.astro';
|
||||||
|
export { default as Avatar } from './Avatar/avatar.astro';
|
||||||
@@ -12,6 +12,7 @@ import ListItemTitle from '../components/ListItem/listItemTitle.astro';
|
|||||||
import ListItemSubtitle from '../components/ListItem/listItemSubtitle.astro';
|
import ListItemSubtitle from '../components/ListItem/listItemSubtitle.astro';
|
||||||
import LoadingBar from '../components/LoadingBar/loadingBar.astro';
|
import LoadingBar from '../components/LoadingBar/loadingBar.astro';
|
||||||
import NumericStepper from '../components/numericStepper/numericStepper.astro';
|
import NumericStepper from '../components/numericStepper/numericStepper.astro';
|
||||||
|
import Avatar from '../components/Avatar/avatar.astro';
|
||||||
import {
|
import {
|
||||||
Arrow2Icon, BinIcon, BurgerIcon, CalendarIcon, CheckIcon, CloseIcon,
|
Arrow2Icon, BinIcon, BurgerIcon, CalendarIcon, CheckIcon, CloseIcon,
|
||||||
CodeIcon, CubeIcon, DownloadIcon, FilterIcon, HelpIcon, HomeIcon,
|
CodeIcon, CubeIcon, DownloadIcon, FilterIcon, HelpIcon, HomeIcon,
|
||||||
@@ -27,17 +28,16 @@ const initialChecked = true;
|
|||||||
<main>
|
<main>
|
||||||
<h1>Nova Design System</h1>
|
<h1>Nova Design System</h1>
|
||||||
<section>
|
<section>
|
||||||
<h2>Numeric Stepper</h2>
|
<h2>Avatar</h2>
|
||||||
<div style="display: flex; flex-direction: column; gap: var(--nds-spacing-md);">
|
<div style="display: flex; flex-direction: column; gap: var(--nds-spacing-md);">
|
||||||
<NumericStepper min={-15} max={10} value={5} step={5} id="my-numeric-stepper"/>
|
<Avatar image="https://static.vecteezy.com/system/resources/thumbnails/057/068/323/small/single-fresh-red-strawberry-on-table-green-background-food-fruit-sweet-macro-juicy-plant-image-photo.jpg" name="John Doe" type="photo"/>
|
||||||
|
<Avatar name="Jane Smith" type="initials"/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h2>Loading Bar</h2>
|
<h2>Numeric Stepper</h2>
|
||||||
<div style="display: flex; flex-direction: column; gap: var(--nds-spacing-md);">
|
<div style="display: flex; flex-direction: column; gap: var(--nds-spacing-md);">
|
||||||
<LoadingBar type="known" percentage={75} width="500px" />
|
<NumericStepper min={-15} max={10} value={5} step={5} id="my-numeric-stepper"/>
|
||||||
<LoadingBar type="unknown" width="500px" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
|
|||||||
Reference in New Issue
Block a user