Edit browse locations section
Create badge atom,
This commit is contained in:
8
src/components/atoms/Badge.svelte
Normal file
8
src/components/atoms/Badge.svelte
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export let text: string
|
||||||
|
export let size: string = 'small'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="badge badge--{size}">
|
||||||
|
<span>{text}</span>
|
||||||
|
</div>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// Components
|
// Components
|
||||||
import Image from '$components/atoms/Image.svelte'
|
import Image from '$components/atoms/Image.svelte'
|
||||||
|
import Badge from '$components/atoms/Badge.svelte'
|
||||||
|
|
||||||
export let location: any
|
export let location: any
|
||||||
|
export let index: number
|
||||||
|
|
||||||
const { name, slug, country, last_updated } = location
|
const { name, slug, country, last_updated } = location
|
||||||
</script>
|
</script>
|
||||||
@@ -13,6 +15,9 @@
|
|||||||
<h3 class="location__name">
|
<h3 class="location__name">
|
||||||
{name}
|
{name}
|
||||||
</h3>
|
</h3>
|
||||||
<span class="text-label">{country.name}</span>
|
<span class="text-label location__country">{country.name}</span>
|
||||||
|
{#if index < 2}
|
||||||
|
<Badge text="New" />
|
||||||
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,13 +14,15 @@
|
|||||||
<ul class="browse__continents" id="continents">
|
<ul class="browse__continents" id="continents">
|
||||||
<li>
|
<li>
|
||||||
<Button tag="button" text="All" class="button-outline" />
|
<Button tag="button" text="All" class="button-outline" />
|
||||||
|
<Button tag="button" text="Europe" class="button-outline" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="browse__locations" id="locations_list" role="list">
|
<div class="browse__locations" id="locations_list" role="list">
|
||||||
{#each locations as location (location.slug)}
|
{#each locations as location, index}
|
||||||
<Location
|
<Location
|
||||||
location={location}
|
location={location}
|
||||||
|
index={index}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
22
src/style/atoms/_badge.scss
Normal file
22
src/style/atoms/_badge.scss
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
.badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0 6px;
|
||||||
|
background-color: $color-secondary-light;
|
||||||
|
border-radius: 100vh;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: $color-primary-darker;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
line-height: 1;
|
||||||
|
min-height: 16px;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
// Small size
|
||||||
|
&--small {
|
||||||
|
span {
|
||||||
|
font-size: rem(7px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,16 @@
|
|||||||
.location {
|
.location {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
// Flag
|
// Flag
|
||||||
img {
|
img {
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
}
|
}
|
||||||
// Link
|
// Link
|
||||||
@@ -17,7 +26,8 @@
|
|||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
span {
|
&__country {
|
||||||
color: $color-tertiary;
|
color: $color-tertiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,21 @@
|
|||||||
.browse {
|
.browse {
|
||||||
|
|
||||||
|
// Description
|
||||||
&__description {
|
&__description {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
margin-bottom: 56px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Continents
|
||||||
|
&__continents {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: 0 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Locations
|
||||||
&__locations {
|
&__locations {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row wrap;
|
flex-flow: row wrap;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
// Atomic Design System
|
// Atomic Design System
|
||||||
// Atoms
|
// Atoms
|
||||||
@import "atoms/button";
|
@import "atoms/button";
|
||||||
|
@import "atoms/badge";
|
||||||
|
|
||||||
// Molecules
|
// Molecules
|
||||||
@import "molecules/photo-card";
|
@import "molecules/photo-card";
|
||||||
|
|||||||
Reference in New Issue
Block a user