From e857eb43f16286901b2be712bba0b9caaeb1ee61 Mon Sep 17 00:00:00 2001 From: Nick Kosarev Date: Fri, 28 Jun 2024 17:01:59 +0000 Subject: [PATCH 1/2] feat: hamburger with sidebar menu on smartphone --- src/lib/components/Hamburger.svelte | 63 +++++++++++++++++ src/lib/components/Header.svelte | 88 +++++------------------- src/lib/components/Locale.svelte | 2 +- src/lib/components/MenuDesktop.svelte | 79 +++++++++++++++++++++ src/lib/components/MenuSmartphone.svelte | 83 ++++++++++++++++++++++ 5 files changed, 244 insertions(+), 71 deletions(-) create mode 100644 src/lib/components/Hamburger.svelte create mode 100644 src/lib/components/MenuDesktop.svelte create mode 100644 src/lib/components/MenuSmartphone.svelte diff --git a/src/lib/components/Hamburger.svelte b/src/lib/components/Hamburger.svelte new file mode 100644 index 00000000..e84ef9a7 --- /dev/null +++ b/src/lib/components/Hamburger.svelte @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/src/lib/components/Header.svelte b/src/lib/components/Header.svelte index 988d9aaf..56c2e01f 100644 --- a/src/lib/components/Header.svelte +++ b/src/lib/components/Header.svelte @@ -1,13 +1,18 @@ + +
- - - - -
- +
+ + {#if innerWidth < 768} + + {:else} + + {/if}
diff --git a/src/lib/components/Locale.svelte b/src/lib/components/Locale.svelte index efa1e6b7..d5274696 100644 --- a/src/lib/components/Locale.svelte +++ b/src/lib/components/Locale.svelte @@ -19,6 +19,6 @@ diff --git a/src/lib/components/MenuDesktop.svelte b/src/lib/components/MenuDesktop.svelte new file mode 100644 index 00000000..7cd19470 --- /dev/null +++ b/src/lib/components/MenuDesktop.svelte @@ -0,0 +1,79 @@ + + + + +
+ +
+ + \ No newline at end of file diff --git a/src/lib/components/MenuSmartphone.svelte b/src/lib/components/MenuSmartphone.svelte new file mode 100644 index 00000000..4aa9a535 --- /dev/null +++ b/src/lib/components/MenuSmartphone.svelte @@ -0,0 +1,83 @@ + + + + +
+ +
+ + + + \ No newline at end of file From b0535b76876deb12bb6b81ac9bdfef2f558a0af7 Mon Sep 17 00:00:00 2001 From: Nick Kosarev Date: Fri, 28 Jun 2024 17:12:04 +0000 Subject: [PATCH 2/2] fix: flex on coupon page --- src/lib/components/Hamburger.svelte | 114 +++++++++--------- src/lib/components/Header.svelte | 8 +- src/lib/components/MenuDesktop.svelte | 48 ++++---- src/lib/components/MenuSmartphone.svelte | 102 ++++++++-------- .../[lang]/(website)/coupon/+page.svelte | 8 ++ 5 files changed, 144 insertions(+), 136 deletions(-) diff --git a/src/lib/components/Hamburger.svelte b/src/lib/components/Hamburger.svelte index e84ef9a7..54801a23 100644 --- a/src/lib/components/Hamburger.svelte +++ b/src/lib/components/Hamburger.svelte @@ -1,63 +1,63 @@ - \ No newline at end of file +.burger { + position: relative; + width: 48px; + height: 24px; + margin: 0; + padding: 0; + border: 0; + background-color: transparent; + cursor: pointer; + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +svg { + min-height: 24px; + transition: transform 0.2s ease-in-out; + color: var(--color-text); +} + +svg line { + stroke: currentColor; + stroke-width: 3; + transition: transform 0.2s ease-in-out +} + +button { + z-index: 10; +} + +.open svg { + color: var(--color-border); +} + +.open #top { + transform: translate(6px, 0px) rotate(45deg) +} + +.open #middle { + opacity: 0; +} + +.open #bottom { + transform: translate(-12px, 9px) rotate(-45deg) +} + diff --git a/src/lib/components/Header.svelte b/src/lib/components/Header.svelte index 56c2e01f..478a0460 100644 --- a/src/lib/components/Header.svelte +++ b/src/lib/components/Header.svelte @@ -1,9 +1,9 @@ + + -
- -
+
+ +
- \ No newline at end of file + diff --git a/src/lib/components/MenuSmartphone.svelte b/src/lib/components/MenuSmartphone.svelte index 4aa9a535..413295dc 100644 --- a/src/lib/components/MenuSmartphone.svelte +++ b/src/lib/components/MenuSmartphone.svelte @@ -1,20 +1,20 @@ -
- -
+
+ +
- + - \ No newline at end of file +.open { + left: 0 +} + +.profile-block { + margin-right: 0.5em; +} + diff --git a/src/routes/[lang]/(website)/coupon/+page.svelte b/src/routes/[lang]/(website)/coupon/+page.svelte index 8b85fe4c..eeb64266 100644 --- a/src/routes/[lang]/(website)/coupon/+page.svelte +++ b/src/routes/[lang]/(website)/coupon/+page.svelte @@ -113,9 +113,17 @@ .latest-coupons .block { display: flex; + flex-direction: row; + flex-wrap: wrap; gap: 1em; } + @media (max-width: 620px) { + .latest-coupons .block { + flex-direction: column; + } + } + .latest-coupons .block .card { border: 2px solid var(--color-border-2); padding: 1em;