Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header Detailpage #64 #11

Merged
merged 10 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/lib/components/atoms/HeaderImage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script>
export let alt = ''
export let src = ''
export let opacity = ''
// Define different image sources for different resolutions or viewport widths
export let Small = 'header-image-small.webp'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some developers in some languages use capitals for objects. Is there purpose behind the capitals on Small, Medium and Large? If so.. is this set as a rule in the code-standards you use?

export let Medium = 'header-image-medium.webp'
export let Large = 'header-image-large.webp'
</script>

<picture>
<!-- Source for small screens -->
<source media="(max-width: 375px)" srcset={Small} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty nice but you only serve webp.. what if a browser doesn't support it? A good practice is serving a jpg as fallback next to a couple of different sized webp images..


<!-- Source for medium screens -->
<source media="(max-width: 768px)" srcset={Medium} />

<!-- Source for large screens -->
<source media="(max-width: 1024px)" srcset={Large} />

<img {src} {alt} style={`opacity: ${opacity}`} />
</picture>

<style>
img {
object-fit: cover;
width: 100%;
height: 100%;
}
</style>
23 changes: 23 additions & 0 deletions src/lib/components/atoms/IconLocation.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script>
export let height = ''
export let width = ''
export let color = ''
</script>

<svg
class="svg-location"
{width}
{height}
fill={color}
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
>
<path
stroke="none"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm used to setting these in a style element or on the SVG main.

stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 .042a9.992 9.992 0 0 0-9.981 9.98c0 2.57 1.99 6.592 5.915 11.954a5.034 5.034 0 0 0 8.132 0c3.925-5.362 5.915-9.384 5.915-11.954A9.992 9.992 0 0 0 12 .042ZM12 14a4 4 0 1 1 4-4 4 4 0 0 1-4 4Z"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you pull this SVG through SVGOMG?

/>
</svg>
130 changes: 130 additions & 0 deletions src/lib/components/molecules/HeaderContent.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<script>
import IconLocation from '../atoms/IconLocation.svelte'
// Mockdata voor de header text
const mockData = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect!

{
title: 'Regular',
subtitle: 'cocktail walk',
label: 'route 1',
location: 'Center, West',
price: '€25,95',
},
{
title: 'Premium',
subtitle: 'cocktail walk',
label: 'route 2',
location: 'Center, West',
price: '€26,95',
},
{
title: 'Bols',
subtitle: 'cocktail walk',
label: 'route 3',
location: 'Center, West',
price: '€29,95',
},
]
</script>

<section class="content-container">
<!-- First content row -->
<div class="title-label">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this <div> could be a <header> element.. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header

<h1>{mockData[0].title}</h1>
<span class="label" aria-hidden="true">{mockData[0].label}</span>
</div>

<!-- Second content row -->
<h1 class="subtitle">{mockData[0].subtitle}</h1>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ony one <h1> element is allowed. I think you want a different heading level here..


<!-- Last content row -->
<div class="location-price">
<IconLocation width="15" height="15" color="hsl(21.23, 100%, 87.25%)" />
<p class="location">{mockData[0].location}</p>
<p class="price">{mockData[0].price}</p>
</div>
</section>

<style>
.content-container {
display: flex;
flex-direction: column;
gap: 0.6rem;
margin: 5rem 2rem;
}
/* First content row */
h1 {
display: flex;
align-items: center;
font-size: 2rem;
text-transform: uppercase;
color: white;
}
.title-label {
display: flex;
align-items: center;
gap: 1rem;
}
.label {
padding: 0.3rem 0.5rem;
border: 1px solid var(--accent2-tertiary);
border-radius: 3rem;
font-size: 1rem;
font-weight: 600;
text-align: center;
color: var(--accent2-tertiary);
}
/* Second content row */
.subtitle {
font-size: 2rem;
text-transform: uppercase;
color: white;
}
/* Last content row */
.location-price {
display: flex;
align-items: center;
}
.location {
margin: 0 1rem 0 0.5rem;
color: var(--accent2-tertiary);
}
.price {
font-weight: 600;
color: var(--accent2-primary);
}
/* Large screens */
@media screen and (min-width: 768px) {
.content-container {
margin: 8rem 8rem;
}
h1 {
font-size: 3rem;
}
.label {
padding: 0.5rem 0.8rem;
font-size: 1.3rem;
}
.subtitle {
font-size: 3rem;
}
.location {
font-size: 1.3rem;
}
.price {
font-size: 1.3rem;
}
}
</style>
32 changes: 32 additions & 0 deletions src/lib/components/organisms/HeaderDetailPage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script>
import HeaderContent from '../molecules/HeaderContent.svelte'
import HeaderImage from '../atoms/HeaderImage.svelte'
</script>

<div class="header-container">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of nested <div>'s, is this really necessary or can you use a more semantic option instead..

<HeaderImage src={'header-image-large.webp'} opacity="0.2" alt="cocktail" />
<div class="header-text">
<HeaderContent />
</div>
</div>

<style>
.header-container {
position: relative;
width: 100vw;
height: calc(100vh - 3rem);
}
.header-text {
position: absolute;
bottom: 0;
left: 0;
}
/* Large screens */
@media screen and (min-width: 48em) {
.header-text {
top: 0;
}
}
</style>
5 changes: 5 additions & 0 deletions src/lib/components/pages/TicketInfoPage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
import HeaderDetailPage from '../organisms/HeaderDetailPage.svelte'
</script>

<HeaderDetailPage />
3 changes: 3 additions & 0 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ export { default as Footer } from '$lib/components/organisms/Footer.svelte'
export { default as TabBar } from '$lib/components/organisms/TabBar.svelte'

// Templates

// Pages
export { default as TicketInfoPage } from '$lib/components/pages/TicketInfoPage.svelte'
6 changes: 3 additions & 3 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<script>
import { Navigation, Footer, TabBar } from '$lib/index'
import { Navigation, Footer, TabBar, TicketInfoPage } from '$lib/index'
export let data
</script>

<header>
<Navigation navigationItems={data.navigation} />
</header>

<TicketInfoPage />

<main id="main">

<slot />

</main>

<Footer footerItems={data.footer} />
Expand Down
4 changes: 2 additions & 2 deletions src/routes/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<kruimelpad parentSlug />
} -->

<div>
<!-- <div>
Copy link
Member

@ju5tu5 ju5tu5 May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're allowed to delete this ;)

Dit is een slug!!!!
</div>
<style>
div {
color: red;
}
</style>
</style> -->
Binary file added static/Mock-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/Mock-image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/header-image-large.webp
Binary file not shown.
Binary file added static/header-image-medium.webp
Binary file not shown.
Binary file added static/header-image-small.webp
Binary file not shown.
2 changes: 2 additions & 0 deletions static/marker.svg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you pull this through SVGOMG?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.