Digitalt Design,
3. semester
Tekst & billeder
Farver
Æstetik og stemning
Interaktioner
Knapper
Components
Design Patterns
Grid System
Design Tokens
Hierarki
Components
Design Patterns
Hierarki
Grid System
Design Tokens
Components
Components
<Button>Knap</Button>
npm create astro@latest
npm create astro@latest
figma
npm create astro@latest
HOME
PRODUCTS
ABOUT
npm create astro@latest
HOME
PRODUCTS
ABOUT
<Button variant="secondary">Action</Button>
secondary
primary
secondary
primary
---
const { variant } = Astro.props;
---
<button class={variant}>
<slot />
</button>
<style>
.secondary {
background: red;
}
</style>
dynamisk
skabelon
<Button variant="secondary">Knap</Button>
<Button variant="secondary">Knap</Button>
<Button variant="secondary">Knap</Button>
<Button variant="secondary">Send</Button>
<button class="secondary">Send</button>
<Button hasIcon={true}>Send</Button>
<button>
<span>Send</span>
<svg>...</svg>
</button>
<Button link="/send" hasIcon={true}>Send</Button>
<a href="/send">
<span>Send</span>
<svg>...</svg>
</a>
Hvis "link", skift til korrekt HTML-tag
<Button variant="primary"
hasIcon={true}
icon="arrow-right"
link="/send"
>
Send
</Button>
<button>
<span>Send</span>
<svg>...</svg>
</button>
<ul>
<Card title="Animation"
description="Learn the latest..."
link="/animation"
/>
<!-- flere Cards -->
</ul>
<!-- ... -->
<ul>
<li>
<h3>Animation</h3>
<p>
Learn the latest animation techniques.
</p>
<a href="/animation" class="ghost">
Get started
</a>
</li>
<!-- flere Cards -->
</ul>
<!-- ... -->
Button.astro
<li>
<h3>{title}</h3>
<p>
{description}
</p>
<Button variant="ghost">Get started</Button>
</li>
Button.astro
---
import Button from "./components/Button.astro"
---
<li>
<h3>{title}</h3>
<p>
{description}
</p>
<Button variant="ghost">Get started</Button>
</li>
---
import Button from "./components/Button.astro"
---
<li>
<h3>{title}</h3>
<p>
{description}
</p>
<Button variant="ghost">Get started</Button>
</li>
---
import Button from "./components/Button.astro"
---
<li>
<h3>{title}</h3>
<p>
{description}
</p>
<Button variant="ghost">Get started</Button>
</li>
Nested component
Hvor ser vi components?
Hvor ser vi components?
Header.astro
Button.astro
Footer.astro
Card.astro
CardSection.astro
Hero.astro
Hvad er den bygget op af?
Hvad er den bygget op af?
Brug Card
<ul>
<Card iconName="running-man"
title="Animation"
description="Learn the latest..."
link="/animation"
/>
<!-- ... -->
</ul>
Brug Card
<ul>
<Card iconName="img"
title="Design"
description="Create beautiful, usable..."
link="/design"
/>
<!-- ... -->
</ul>
Styling af Card
<!-- Astro Props & HTML for Card -->
<style>
li {
display: flex;
flex-flow: column;
aspect-ratio: 1;
padding: 2rem;
background: #fff;
border-radius: 0.5rem;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
</style>
Styling af Card
<!-- Astro Props & HTML for Card -->
<style>
li {
display: flex;
flex-flow: column;
aspect-ratio: 1;
padding: 2rem;
background: #fff;
border-radius: 0.5rem;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
</style>
Påvirker kun `li` i Card, ikke andre
Styling af Card
<!-- Astro Props & HTML for Card -->
<style>
h3 {
color: #000;
font-size: 1.25rem;
margin: 0;
}
</style>
Påvirker kun `h3` i Card, ikke andre