Add ProjectList and ProjectItem
Rendering projects on the home page
This commit is contained in:
parent
980a6395f1
commit
4540760868
2 changed files with 126 additions and 0 deletions
50
src/lib/components/ProjectItem.svelte
Normal file
50
src/lib/components/ProjectItem.svelte
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<script lang="ts">
|
||||
import SVGHoverEffect from '$components/SVGHoverEffect.svelte'
|
||||
import type { SvelteComponent } from 'svelte'
|
||||
|
||||
export let SVGComponent: typeof SvelteComponent
|
||||
export let backgroundColor: string
|
||||
export let name: string
|
||||
export let description: string
|
||||
</script>
|
||||
|
||||
<div class="project-item">
|
||||
<SVGHoverEffect
|
||||
{SVGComponent}
|
||||
{backgroundColor}
|
||||
maxMovement={10}
|
||||
smoothness={0.1}
|
||||
containerHeight="220px"
|
||||
bounceStiffness={0.1}
|
||||
bounceDamping={0.2}
|
||||
/>
|
||||
<h3 class="project-name">{name}</h3>
|
||||
<p class="project-description">{description}</p>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.project-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $unit;
|
||||
}
|
||||
|
||||
.project-name {
|
||||
margin: $unit 0 $unit-half;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: $red-60;
|
||||
}
|
||||
|
||||
.project-description {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
max-height: 2.8em;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
76
src/lib/components/ProjectList.svelte
Normal file
76
src/lib/components/ProjectList.svelte
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<script lang="ts">
|
||||
import ProjectItem from '$components/ProjectItem.svelte'
|
||||
|
||||
import MaitsuLogo from '$illos/logo-maitsu.svg?component'
|
||||
import SlackLogo from '$illos/logo-slack.svg?component'
|
||||
import FigmaLogo from '$illos/logo-figma.svg?component'
|
||||
import PinterestLogo from '$illos/logo-pinterest.svg?component'
|
||||
import SVGHoverEffect from '$components/SVGHoverEffect.svelte'
|
||||
|
||||
interface Project {
|
||||
SVGComponent: typeof SvelteComponent
|
||||
backgroundColor: string
|
||||
name: string
|
||||
description: string
|
||||
}
|
||||
|
||||
const projects: Project[] = [
|
||||
{
|
||||
SVGComponent: MaitsuLogo,
|
||||
backgroundColor: '#FFF7EA',
|
||||
name: 'Maitsu',
|
||||
description:
|
||||
"As a personal project, I'm building a hobby journal that helps people make something new every week."
|
||||
},
|
||||
{
|
||||
SVGComponent: SlackLogo,
|
||||
backgroundColor: '#4a154b',
|
||||
name: 'Slack',
|
||||
description: 'I led design for end-user facing automation features at Slack.'
|
||||
},
|
||||
{
|
||||
SVGComponent: FigmaLogo,
|
||||
backgroundColor: '#2c2c2c',
|
||||
name: 'Figma',
|
||||
description: 'I helped lead and set the direction for the early prototyping team at Figma.'
|
||||
},
|
||||
{
|
||||
SVGComponent: PinterestLogo,
|
||||
backgroundColor: '#f7f7f7',
|
||||
name: 'Pinterest',
|
||||
description:
|
||||
'As the first design hire at Pinterest, I helped define product direction and grow the design team.'
|
||||
}
|
||||
]
|
||||
</script>
|
||||
|
||||
<section class="projects">
|
||||
<ul>
|
||||
{#each projects as project}
|
||||
<li>
|
||||
<ProjectItem {...project} />
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<style lang="scss">
|
||||
.projects ul {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
gap: $unit-4x;
|
||||
margin: 0;
|
||||
|
||||
@include breakpoint('phone') {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
li {
|
||||
flex: 0 0 calc(50% - #{$unit-2x}); /* 50% width minus gap */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in a new issue