Skip to content

Commit 486c2b4

Browse files
committed
ENH: carousel, thumbtack, cleanup
Got the carousel to work thanks to a PR (vadimkorr/svelte-carousel#141) Added a thumbtack thanks to this codepen: https://codepen.io/jamielife/pen/LpGWWP
1 parent 5d5b8ec commit 486c2b4

File tree

9 files changed

+44
-64
lines changed

9 files changed

+44
-64
lines changed

cestlavie-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"smol-toml": "^1.3.0",
3939
"smui-theme": "^7.0.0",
4040
"svelte": "^4.2.19",
41-
"svelte-carousel": "^1.0.25",
41+
"svelte-carousel": "vadimkorr/svelte-carousel#pull/142/head",
4242
"svelte-check": "^3.6.0",
4343
"svelte-material-ui": "^7.0.0",
4444
"tslib": "^2.4.1",
Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script>
2-
import LayoutGrid, { Cell } from '@smui/layout-grid';
3-
import PortfolioCard from './PortfolioCard.svelte';
2+
import StubCard from './StubCard.svelte';
43
54
export let items = [];
65
export let path;
@@ -10,19 +9,9 @@
109
<article id="portfolio" class="panel">
1110
<!-- <LayoutGrid> -->
1211
<div id="wrapper">
13-
{#each items.slice(0, 12) as item}
12+
{#each items as item}
1413
<div class="cell">
15-
<div>
16-
<div class="pushpin tilted">
17-
<div class="pinhead"></div>
18-
<div class="pinbase"></div>
19-
<div class="pinshaft"></div>
20-
<div class="pinpoint"></div>
21-
</div>
22-
</div>
23-
<Cell>
24-
<PortfolioCard {path} {item} width={"250px"} height={""}/>
25-
</Cell>
14+
<StubCard {path} {item} width={"100px"} height={""}/>
2615
</div>
2716
{/each}
2817
</div>
@@ -39,9 +28,7 @@
3928
4029
#wrapper {
4130
display: grid;
42-
grid-template-columns: repeat(4, 2fr);
43-
}
44-
45-
@import './css/pushpin.css'
46-
47-
</style>
31+
grid-template-columns: repeat(4, 1fr);
32+
row-gap: 50px;
33+
}
34+
</style>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script>
2-
import { mdiLink, mdiClose } from '@mdi/js';
3-
import Card, { Content, Actions, ActionButtons, ActionIcons } from '@smui/card';
4-
import Button, { Label } from '@smui/button';
2+
import { mdiClose } from '@mdi/js';
3+
import Card, { Content } from '@smui/card';
54
import IconButton, { Icon } from '@smui/icon-button';
65
import Dialog, { Content as DContent } from '@smui/dialog';
76
import markdownit from 'markdown-it';
@@ -15,29 +14,25 @@
1514
let open = false;
1615
</script>
1716

18-
<Card>
19-
<Content>
20-
{#if item.filename}
21-
<div class="image">
22-
<Stub {path} {item} {width} {height}/>
23-
</div>
24-
{/if}
25-
</Content>
26-
<Actions style="align-items:end">
27-
<ActionButtons>
28-
<Button on:click={() => (open = true)}>
29-
<Label>Details</Label>
30-
</Button>
31-
</ActionButtons>
32-
<ActionIcons>
33-
<IconButton on:click={() => window.open(item.website)} title="Open Link">
34-
<Icon tag="svg" viewBox="0 0 24 24">
35-
<path fill="currentColor" d={mdiLink} />
36-
</Icon>
37-
</IconButton>
38-
</ActionIcons>
39-
</Actions>
40-
</Card>
17+
<div>
18+
<div class="pushpin tilted">
19+
<div class="pinhead"></div>
20+
<div class="pinbase"></div>
21+
<div class="pinshaft"></div>
22+
<div class="pinpoint"></div>
23+
</div>
24+
<div class="stub card">
25+
<Card on:click={() => (open = true)}>
26+
<Content>
27+
{#if item.filename}
28+
<div class="image">
29+
<Stub {path} {item} {width} {height}/>
30+
</div>
31+
{/if}
32+
</Content>
33+
</Card>
34+
</div>
35+
</div>
4136
<Dialog bind:open sheet aria-describedby="sheet-content">
4237
<DContent id="sheet-content">
4338
<IconButton action="close" class="material-icons">
@@ -57,9 +52,14 @@
5752
</Dialog>
5853

5954
<style>
55+
@import './css/pushpin.css';
56+
6057
.image {
6158
display: grid;
6259
place-items: center;
6360
}
6461
62+
.card:hover {
63+
cursor: pointer;
64+
}
6565
</style>

cestlavie-app/src/routes/+page.svelte

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<!-- {#each names as title}
3434
<Tix {title}/>
3535
{/each} -->
36-
<img class="stub" src="data/labelling/images/stubs/b6fc8982-scrapbook_26-stub_06.jpg" alt="image of the Arc de Triomphe">
36+
<img class="stub" src="data/labelling/images/stubs/b6fc8982-scrapbook_26-stub_06.jpg" alt="ticket stub of the Arc de Triomphe">
3737
</div>
3838

3939
<style>
@@ -44,7 +44,4 @@
4444
column-gap: 30px;
4545
}
4646
47-
.stub {
48-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
49-
}
50-
</style>
47+
</style>
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
export const prerender = true
22

33
export const load = async ({ url, fetch }) => {
4-
const Res = await fetch(`${url.origin}/api/scrapbook/stub_text_extraction.toml`)
5-
const collection = await Res.json()
64

75
var pages = Object.keys(import.meta.glob('/static/data/labelling/images/*.jpg'));
86
pages = pages.map(page => page.slice(8))
9-
10-
const path = '/data/labelling/images/stubs'
117

12-
return { collection, path, pages }
8+
return { pages }
139
}

cestlavie-app/src/routes/carousel/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
<h1>Scrapbook</h1>
1616

17-
<!-- <Carousel {images} /> -->
17+
<Carousel {images} />
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<script>
2-
import Carousel from "$lib/components/Carousel.svelte";
32
import Gallery from "$lib/components/Gallery.svelte";
43
54
export let data;
65
76
// consider using the route as the property name for the collection
87
const items = data.collection.stubs;
98
const path = data.path;
10-
const images = data.pages;
119
1210
</script>
1311

@@ -18,6 +16,5 @@
1816
<h1>Ticket Stubs</h1>
1917

2018
<div>
21-
<!-- <Carousel {images} /> -->
2219
<Gallery {path} {items} />
2320
</div>

cestlavie-app/static/css/components.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@
5757

5858
}
5959
}
60+
61+
.stub {
62+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
63+
}

cestlavie-app/yarn.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,10 +3247,9 @@ supports-color@^7.1.0:
32473247
dependencies:
32483248
has-flag "^4.0.0"
32493249

3250-
svelte-carousel@^1.0.25:
3250+
svelte-carousel@vadimkorr/svelte-carousel#pull/142/head:
32513251
version "1.0.25"
3252-
resolved "https://registry.yarnpkg.com/svelte-carousel/-/svelte-carousel-1.0.25.tgz#0a109455009f449242b17e3c213cbe7e9c37ef35"
3253-
integrity sha512-vR/AbGYwlh3fgWaB5PJg+iqZFvoVCJq4JWdmlXvPtdG9TLlKJWBcoiKlMZt3MnFF7AqNW46tOH/O+uVMWQzyWQ==
3252+
resolved "https://codeload.github.com/vadimkorr/svelte-carousel/tar.gz/a299747c626d559ad02dde0a1463243bb07935df"
32543253
dependencies:
32553254
easy-reactive "1.0.4"
32563255

0 commit comments

Comments
 (0)