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

Add gift guide #21

Merged
merged 2 commits into from
Nov 29, 2023
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
7 changes: 7 additions & 0 deletions src/lib/components/Header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@
>
shop
</a>
<a
data-sveltekit-preload-data
class={selected.includes("gift") ? "selected" : ""}
href="/gift-guide"
>
gift guide
</a>
<a
data-sveltekit-preload-data
class={selected.includes("repairs") ? "selected" : ""}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/ScrollDown/ScrollDown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { fade } from "svelte/transition";
</script>

<section in:fade={{ delay: 500, duration: 1000 }} class="mobile-scroll-prompt">
<section in:fade={{ delay: 300, duration: 1000 }} class="mobile-scroll-prompt">
<button
on:click={() =>
window.scroll({
Expand Down Expand Up @@ -47,8 +47,8 @@
height: 24px;
border-left: 1px solid grey;
border-bottom: 1px solid grey;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
box-sizing: border-box;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<script>
$: aboutHover = false;
$: guideHover = false;
</script>

<a data-sveltekit-preload-data href="/about" class="about" data-test-id="about">
<a
data-sveltekit-preload-data
href="/gift-guide"
class="guide"
data-test-id="guide"
>
<svg
on:mouseenter={() => (aboutHover = true)}
on:mouseleave={() => (aboutHover = false)}
on:mouseenter={() => (guideHover = true)}
on:mouseleave={() => (guideHover = false)}
viewBox="0 0 243.646 163.987"
>
<g class={aboutHover ? "layer1" : ""} transform="translate(76.396 -14.274)">
<g class={guideHover ? "layer1" : ""} transform="translate(76.396 -14.274)">
<rect
style="fill:#fff;stroke:#fff;stroke-width:.265832"
width="230.89"
Expand Down Expand Up @@ -40,8 +45,8 @@
style="fill:#000;fill-opacity:1;stroke:none;stroke-width:.697463"
x="44.113"
y="85.513"
><tspan style="stroke-width:.697463" x="44.113" y="85.513">about</tspan
><tspan style="stroke-width:.697463" x="44.113" y="121.508">us</tspan
><tspan style="stroke-width:.697463" x="44.113" y="85.513">gift</tspan
><tspan style="stroke-width:.697463" x="44.113" y="121.508">guide</tspan
></text
>
<path
Expand Down Expand Up @@ -71,7 +76,7 @@
/>
</g>
<g
class={aboutHover ? "layer2" : "hidden"}
class={guideHover ? "layer2" : "hidden"}
transform="translate(76.396 -14.274)"
>
<rect
Expand Down Expand Up @@ -105,8 +110,8 @@
style="fill:#000;fill-opacity:1;stroke:none;stroke-width:.697463"
x="44.113"
y="85.513"
><tspan style="stroke-width:.697463" x="44.113" y="85.513">about</tspan
><tspan style="stroke-width:.697463" x="44.113" y="121.508">us</tspan
><tspan style="stroke-width:.697463" x="44.113" y="85.513">gift</tspan
><tspan style="stroke-width:.697463" x="44.113" y="121.508">guide</tspan
></text
>
<path
Expand Down
2 changes: 2 additions & 0 deletions src/lib/utils/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const MOBILE_ABOUT_US =
"https://enki.imgix.net/mobile_about_us_3.png?auto=format,compress";
export const DESKTOP_LANDING_PAGE =
"https://enki.imgix.net/inside_enki_desktop_4.png?auto=format,compress";
export const MOBILE_GIFT_GUIDE =
"https://enki.imgix.net/mobile_gift_guide_1.png?auto=format,compress";

const whitelistedUserAgent = [
"GoogleBot",
Expand Down
40 changes: 12 additions & 28 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
MOBILE_CONTACT_US,
MOBILE_JEWELLERY_SERVICES,
MOBILE_ONLINE_SHOP,
MOBILE_GIFT_GUIDE,
MOBILE_LANDING_PAGE,
MOBILE_JEWELLERY_CLASSES,
} from "$lib/utils/consts";
import OnlineShop from "$lib/components/Svg/OnlineShop.svelte";
import JewelleryServices from "$lib/components/Svg/JewelleryServices.svelte";
import AboutUs from "$lib/components/Svg/AboutUs.svelte";
import Classes from "$lib/components/Svg/Classes.svelte";
import TagView from "$lib/components/TagView/TagView.svelte";
import GiftGuide from "$lib/components/Svg/GiftGuide.svelte";

$: outerWidth = 0;
$: innerWidth = 0;
Expand Down Expand Up @@ -57,6 +57,13 @@
alt="online shop button"
/>
</a>
<a data-sveltekit-preload-data href="/gift-guide">
<img
class="mobile-gift-guide-img"
src={MOBILE_GIFT_GUIDE}
alt="gift guide button"
/>
</a>
<a data-sveltekit-preload-data href="/repairs">
<img
class="mobile-repairs-and-comms-img"
Expand Down Expand Up @@ -90,12 +97,9 @@
<JewelleryServices />
<Classes />
<OnlineShop />
<AboutUs />
<GiftGuide />
{/if}
</figure>

<h1 class="featured">Gift guide</h1>
<TagView prefix="FEATURED" showHex={false} />
{/if}

<style>
Expand All @@ -120,7 +124,7 @@
display: flex;
flex-direction: column;
justify-content: flex-end;
height: 200vh;
height: 150vh;
width: 100%;
}

Expand All @@ -141,29 +145,9 @@
.mobile-repairs-and-comms-img,
.mobile-online-shop-img,
.mobile-contact-us-img,
.mobile-gift-guide-img,
.mobile-about-us-img {
height: auto;
max-width: 100%;
}

.featured {
background-color: white;
text-align: center;
font-family: "Welcomehome5 Regular";
width: 100%;
}

@media (min-width: 1200px) {
.featured {
margin: 4%;
font-size: 2.5em;
}
}

@media (min-width: 2400px) {
.featured {
margin: 4%;
font-size: 3em;
}
}
</style>
31 changes: 31 additions & 0 deletions src/routes/gift-guide/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script lang="ts">
import TagView from "$lib/components/TagView/TagView.svelte";
</script>

<h1 class="featured">Gift guide</h1>
<TagView prefix="FEATURED" showHex={false} />

<style>
.featured {
background-color: white;
text-align: center;
font-family: "Welcomehome5 Regular";
width: 100vw;
}

@media (min-width: 1200px) {
.featured {
margin-top: 4%;
margin-bottom: 4%;
font-size: 2.5em;
}
}

@media (min-width: 2400px) {
.featured {
margin-top: 4%;
margin-bottom: 4%;
font-size: 3em;
}
}
</style>
31 changes: 21 additions & 10 deletions tests/components/header.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,40 @@ test.describe("Header", () => {
await page.waitForURL("http://localhost:4000/");
expect(page.url()).toBe("http://localhost:4000/");

await expect(page.locator("a >> nth=1")).toHaveText("repairs");
await expect(page.locator("a >> nth=1")).toHaveText("gift guide");
await page.locator("a >> nth=1").click();
await page.waitForURL("http://localhost:4000/gift-guide");
expect(page.url()).toBe("http://localhost:4000/gift-guide");
await page.locator("img.enki-logo").click();
await page.waitForURL("http://localhost:4000/");
expect(page.url()).toBe("http://localhost:4000/");

await expect(page.locator("a >> nth=2")).toHaveText("repairs");
await page.locator("a >> nth=2").click();
await page.waitForURL("http://localhost:4000/repairs");
expect(page.url()).toBe("http://localhost:4000/repairs");
await page.locator("img.enki-logo").click();
await page.waitForURL("http://localhost:4000/");
expect(page.url()).toBe("http://localhost:4000/");

await expect(page.locator("a >> nth=2")).toHaveText("classes");
await page.locator("a >> nth=2").click();
await expect(page.locator("a >> nth=3")).toHaveText("classes");
await page.locator("a >> nth=3").click();
await page.waitForURL("http://localhost:4000/classes");
expect(page.url()).toBe("http://localhost:4000/classes");
await page.locator("img.enki-logo").click();
await page.waitForURL("http://localhost:4000/");
expect(page.url()).toBe("http://localhost:4000/");

await expect(page.locator("a >> nth=3")).toHaveText("about");
await page.locator("a >> nth=3").click();
await expect(page.locator("a >> nth=4")).toHaveText("about");
await page.locator("a >> nth=4").click();
await page.waitForURL("http://localhost:4000/about");
expect(page.url()).toBe("http://localhost:4000/about");
await page.locator("img.enki-logo").click();
await page.waitForURL("http://localhost:4000/");
expect(page.url()).toBe("http://localhost:4000/");

await expect(page.locator("a >> nth=4")).toHaveText("contact");
await page.locator("a >> nth=4").click();
await expect(page.locator("a >> nth=5")).toHaveText("contact");
await page.locator("a >> nth=5").click();
await page.waitForURL("http://localhost:4000/contact");
expect(page.url()).toBe("http://localhost:4000/contact");
await page.locator("img.enki-logo").click();
Expand All @@ -113,15 +121,18 @@ test.describe("Header", () => {
await page.waitForURL("http://localhost:4000/shop");
expect(page.url()).toBe("http://localhost:4000/shop");
await page.locator("a >> nth=1").click();
await page.waitForURL("http://localhost:4000/gift-guide");
expect(page.url()).toBe("http://localhost:4000/gift-guide");
await page.locator("a >> nth=2").click();
await page.waitForURL("http://localhost:4000/repairs");
expect(page.url()).toBe("http://localhost:4000/repairs");
await page.locator("a >> nth=2").click();
await page.locator("a >> nth=3").click();
await page.waitForURL("http://localhost:4000/classes");
expect(page.url()).toBe("http://localhost:4000/classes");
await page.locator("a >> nth=3").click();
await page.locator("a >> nth=4").click();
await page.waitForURL("http://localhost:4000/about");
expect(page.url()).toBe("http://localhost:4000/about");
await page.locator("a >> nth=4").click();
await page.locator("a >> nth=5").click();
await page.waitForURL("http://localhost:4000/contact");
expect(page.url()).toBe("http://localhost:4000/contact");
await page.locator("img.enki-logo").click();
Expand Down
Binary file modified tests/routes/about.spec.js-snapshots/About-Page-1-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 3 additions & 12 deletions tests/routes/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
import {
MOBILE_CONTACT_US,
MOBILE_JEWELLERY_CLASSES,
MOBILE_JEWELLERY_SERVICES,
MOBILE_LANDING_PAGE,
MOBILE_ONLINE_SHOP,
MOBILE_ABOUT_US,
DESKTOP_LANDING_PAGE,
} from "../../src/lib/utils/consts.js";
import { expect, test } from "@playwright/test";

test.describe("Mobile Home Page", () => {
Expand Down Expand Up @@ -47,9 +38,9 @@ test.describe("Desktop Home Page", () => {
expect(page.url()).toBe("http://localhost:4000/shop");
await page.goBack();
expect(page.url()).toBe("http://localhost:4000/");
await page.locator("data-test-id=about").click();
await page.waitForURL("http://localhost:4000/about");
expect(page.url()).toBe("http://localhost:4000/about");
await page.locator("data-test-id=guide").click();
await page.waitForURL("http://localhost:4000/gift-guide");
expect(page.url()).toBe("http://localhost:4000/gift-guide");
await page.goBack();
expect(page.url()).toBe("http://localhost:4000/");
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading