Skip to content

Commit

Permalink
style: 💄 mobile landing
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskaransarkaria committed Feb 4, 2022
1 parent 927d8b7 commit 43a220b
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .routify/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = {
noHashScroll: false,
distDir: 'dist',
extensions: ['svelte', 'html', 'svx', 'md'],
started: '2022-02-01T21:44:36.651Z',
started: '2022-02-04T16:18:29.095Z',
};
4 changes: 2 additions & 2 deletions .routify/routes.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* @roxi/routify 2.7.3
* File generated Tue Feb 01 2022 21:44:39 GMT+0000 (Greenwich Mean Time)
* File generated Fri Feb 04 2022 16:18:31 GMT+0000 (Greenwich Mean Time)
*/

export const __version = '2.7.3';
export const __timestamp = '2022-02-01T21:44:39.667Z';
export const __timestamp = '2022-02-04T16:18:31.644Z';

//buildRoutes
import { buildClientTree } from '@roxi/routify/runtime/buildRoutes';
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle-1643751876649.css'>
<link rel='stylesheet' href='/build/bundle-1643991509093.css'>

<script defer src='/build/bundle-1643751876649.js'></script>
<script defer src='/build/bundle-1643991509093.js'></script>
</head>
<body>
</body>
Expand Down
Binary file added public/mobile_about_us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/mobile_classes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/mobile_contact_us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
231 changes: 231 additions & 0 deletions public/mobile_contact_us.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/mobile_jewellery_classes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/mobile_jewellery_services.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/mobile_online_shop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/components/Header/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,36 @@
() => (isBasketPage = window.location.pathname === '/shop/basket')
);
function clickOutside(
node: HTMLElement,
{ enabled: initialEnabled, cb }: { enabled: boolean; cb: () => void }
) {
const handleOutsideClick: (this: Window, ev: MouseEvent) => void = ({
target,
}: {
target: HTMLElement;
}) => {
if (!node.contains(target)) {
cb();
}
};
function update({ enabled }: { enabled: boolean }) {
if (enabled) {
window.addEventListener('click', handleOutsideClick);
} else {
window.removeEventListener('click', handleOutsideClick);
}
}
update({ enabled: initialEnabled });
return {
update,
destroy() {
window.removeEventListener('click', handleOutsideClick);
},
};
}
function handleClick() {
if (!showSearch) {
left.set(-offset);
Expand Down Expand Up @@ -106,6 +136,7 @@
alt="search"
style={move($left)}
on:click={handleClick}
use:clickOutside={{ enabled: showSearch, cb: handleClick }}
/>
{#if showSearch}
<div class="search-bar" style={grow($growSearch, $searchLeft)}>
Expand Down
140 changes: 101 additions & 39 deletions src/pages/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,93 @@
$: repairsAndCommissionsHover = false;
$: classesHover = false;
$: contactHover = false;
$: isMobile = outerWidth <= 450 ? true : false;
</script>

<svelte:window bind:outerWidth />
<figure>
<figure class={isMobile ? 'mobile-container' : 'container'}>
<img
class="inside-shop"
class={isMobile ? 'parrallax-inside-shop' : 'inside-shop'}
src={`http://enki.imgix.net/inside-enki${
outerWidth <= 450 ? '-mobile' : '-no-signs'
}.png?${outerWidth <= 450 ? 'fit=crop' : 'format=auto'}&w=${outerWidth}`}
alt="welcome to the shop, this ilustration shows the shopkeeper behind her bench"
/>
<img
class="repairs-and-comms"
src={repairsAndCommissionsHover
? '/jewellery_services.gif'
: '/jewellery_services.png'}
alt="repair and commissions button hover over me"
on:mouseenter={() => (repairsAndCommissionsHover = true)}
on:mouseleave={() => (repairsAndCommissionsHover = false)}
on:click={$goto('/services')}
/>
<img
class="classes"
src={classesHover ? '/classes.gif' : '/classes.png'}
alt="classes button hover over me"
on:mouseenter={() => (classesHover = true)}
on:mouseleave={() => (classesHover = false)}
on:click={$goto('/classes')}
/>
<img
class="online-shop"
src={`https://enki.imgix.net/${
onlineShopHover ? 'online_shop.gif' : 'online-shop.png'
}`}
alt="online shop button hover over me"
on:mouseenter={() => (onlineShopHover = true)}
on:mouseleave={() => (onlineShopHover = false)}
on:click={$goto('/shop')}
/>
<img
class="contact"
src={contactHover ? '/contact.gif' : '/contact.png'}
alt="online shop button hover over me"
on:mouseenter={() => (contactHover = true)}
on:mouseleave={() => (contactHover = false)}
on:click={$goto('/contact')}
/>
{#if isMobile}
<div class="mobile-button-container">
<img
class="mobile-online-shop"
src="/mobile_online_shop.png"
alt="online shop button"
on:click={$goto('/shop')}
/>
<img
class="mobile-repairs-and-comms"
src="/mobile_jewellery_services.png"
alt="jewellery services button"
on:click={$goto('/services')}
/>
<img
class="mobile-classes"
src="/mobile_jewellery_classes.png"
alt="classes button"
on:click={$goto('/classes')}
/>
<img
class="mobile-contact-us"
src="/mobile_contact_us.png"
alt="contact us button"
on:click={$goto('/contact')}
/>
<img
class="mobile-about-us"
src="/mobile_about_us.png"
alt="about us button"
on:click={$goto('/about')}
/>
</div>
{:else}
<img
class="repairs-and-comms"
src={repairsAndCommissionsHover
? '/jewellery_services.gif'
: '/jewellery_services.png'}
alt="repair and commissions button hover over me"
on:mouseenter={() => (repairsAndCommissionsHover = true)}
on:mouseleave={() => (repairsAndCommissionsHover = false)}
on:click={$goto('/services')}
/>
<img
class="classes"
src={classesHover ? '/classes.gif' : '/classes.png'}
alt="classes button hover over me"
on:mouseenter={() => (classesHover = true)}
on:mouseleave={() => (classesHover = false)}
on:click={$goto('/classes')}
/>
<img
class="online-shop"
src={`https://enki.imgix.net/${
onlineShopHover ? 'online_shop.gif' : 'online-shop.png'
}`}
alt="online shop button hover over me"
on:mouseenter={() => (onlineShopHover = true)}
on:mouseleave={() => (onlineShopHover = false)}
on:click={$goto('/shop')}
/>
<img
class="contact"
src={contactHover ? '/contact.gif' : '/contact.png'}
alt="online shop button hover over me"
on:mouseenter={() => (contactHover = true)}
on:mouseleave={() => (contactHover = false)}
on:click={$goto('/contact')}
/>
{/if}
</figure>

<style>
figure {
.container {
display: grid;
grid-template-columns: repeat(100, 1fr);
grid-template-rows: repeat(100, 1fr);
Expand All @@ -70,13 +106,39 @@
margin-right: 0;
}
.mobile-container {
display: flex;
flex-direction: column;
width: 100vw;
margin-left: 0;
margin-right: 0;
}
.mobile-button-container {
display: flex;
flex-direction: column;
justify-content: flex-end;
height: 175vh;
width: 100vw;
}
.mobile-button-container > * {
width: 80%;
align-self: center;
padding: 10px;
}
.inside-shop {
grid-column-start: 1;
grid-column-end: span end;
grid-row-start: 1;
grid-row-end: span end;
}
.parrallax-inside-shop {
position: fixed;
}
.contact,
.classes,
.repairs-and-comms,
Expand Down

0 comments on commit 43a220b

Please sign in to comment.