Hvad er det?
Hvordan det føles at bygge noget
Figma
Logo
Like + Message knapper
Story bar + item
Indlæg-container
Pofilbillede
Brugernavn (verified)
Menu-knap
Billede (karrusel)
Indlæg actions (like osv.)
Diverse (tekst, tilføj, kommentar, timestamp, osv.)
Components
Hvordan det føles at bygge noget
Astro
Et framework, der bl.a. handler om DX
Et værktøj, der hjælper med at bygge hurtigere og smartere
Marketing-afdelingen
Følgende er en hurtig overflyvning af Astro
— det er ikke noget, I skal kunne efter i dag
vs.
Components
<Button>Knap</Button>npm create astro@latestnpm create astro@latestfigma
npm create astro@latestHOME
PRODUCTS
ABOUT
Hvad adskiller dem?
npm create astro@latestHOME
PRODUCTS
ABOUT
<Button variant="secondary">Action</Button>secondary
primary
secondary
primary
<Button variant="secondary" />---
const { variant } = Astro.props;
---
<button class={variant}>
<slot />
</button>
<style>
.secondary {
background: transparent;
border: 2px solid turquoise;
}
</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
Opdeling af HTML
<header>
<h1>Heading</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section>
<section id="services">
<h2>Vores Services</h2>
<div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div>
<div class="service">
<h3>Service 2</h3>
<p>Beskrivelse af service 2.</p>
</div>
<div class="service">
<h3>Service 3</h3>
<p>Beskrivelse af service 3.</p>
</div>
</section>
<footer>
<p>© 2024 Min Side. Alle rettigheder forbeholdes.</p>
</footer><header>
<h1>Velkommen til Min Side</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header><header>
<h1>Heading</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section>
<section id="services">
<h2>Vores Services</h2>
<div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div>
<div class="service">
<h3>Service 2</h3>
<p>Beskrivelse af service 2.</p>
</div>
<div class="service">
<h3>Service 3</h3>
<p>Beskrivelse af service 3.</p>
</div>
</section>
<footer>
<p>© 2024 Min Side. Alle rettigheder forbeholdes.</p>
</footer><section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section><div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div><section id="services">
<h2>Vores Services</h2>
<Service />
<Service />
<Service />
</section><header>
<h1>Velkommen til Min Side</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header><header>
<h1>Heading</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section>
<section id="services">
<h2>Vores Services</h2>
<div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div>
<div class="service">
<h3>Service 2</h3>
<p>Beskrivelse af service 2.</p>
</div>
<div class="service">
<h3>Service 3</h3>
<p>Beskrivelse af service 3.</p>
</div>
</section>
<footer>
<p>© 2024 Min Side. Alle rettigheder forbeholdes.</p>
</footer><section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section><div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div><section id="services">
<h2>Vores Services</h2>
<Service />
<Service />
<Service />
</section><header>
<h1>Velkommen til Min Side</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header><section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section><div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div><section id="services">
<h2>Vores Services</h2>
<Service />
<Service />
<Service />
</section><Layout>
<Hero />
<Services />
</Layout><header>
<h1>Heading</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section>
<section id="services">
<h2>Vores Services</h2>
<div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div>
<div class="service">
<h3>Service 2</h3>
<p>Beskrivelse af service 2.</p>
</div>
<div class="service">
<h3>Service 3</h3>
<p>Beskrivelse af service 3.</p>
</div>
</section>
<footer>
<p>© 2024 Min Side. Alle rettigheder forbeholdes.</p>
</footer><Layout>
<Hero />
<Services />
</Layout><header>
<h1>Heading</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<section id="hero">
<h2>Dette er et Hero-Image</h2>
<p>Her er noget introduktionstekst om denne side.</p>
<button>Lær Mere</button>
</section>
<section id="services">
<h2>Vores Services</h2>
<div class="service">
<h3>Service 1</h3>
<p>Beskrivelse af service 1.</p>
</div>
<div class="service">
<h3>Service 2</h3>
<p>Beskrivelse af service 2.</p>
</div>
<div class="service">
<h3>Service 3</h3>
<p>Beskrivelse af service 3.</p>
</div>
</section>
<footer>
<p>© 2024 Min Side. Alle rettigheder forbeholdes.</p>
</footer>øvelse
Analyser HTML'en og identificér potentielle components (se øvelsen på Fronter)
øvelse
Analyser HTML'en og identificér potentielle components (se øvelsen på Fronter)
Hvor ser vi components?
Header.astro
Button.astro
Footer.astro
Card.astro
CardSection.astro
Hero.astro
Astro-components
├── src/
└── components/
└── Header.astro
└── CardSection.astro
└──
└── Button.astro
└── Footer.astroCard.astroAstro-components
<li>
<h3>Animation</h3>
<p>
Learn the latest animation techniques to create stunning motion
design and captivate your audience.
</p>
<a href="/animation" class="btn" data-variant="ghost">Get started</a>
</li>Card.astroAstro-components
---
import Card from "../components/ ";
---
<Card />
<Card />
<Card />
<Card />
<Card />
<Card />Card.astroKonvention: Samme navn
npm create astro@latest .npm create astro@latest .npm install