diff options
| author | secondl1ght <[email protected]> | 2022-07-31 13:41:15 -0600 |
|---|---|---|
| committer | secondl1ght <[email protected]> | 2022-07-31 13:41:15 -0600 |
| commit | 7ecf3258c259eb259d8dfb3c4a47d4ede82f5c56 (patch) | |
| tree | 7e0bbee4eee9aa478322a8d2df8d41366da409d5 | |
| parent | 96a36294f143b38a2ba4f914df092b4ab85c62bb (diff) | |
| download | coinos-ui-7ecf3258c259eb259d8dfb3c4a47d4ede82f5c56.tar.gz coinos-ui-7ecf3258c259eb259d8dfb3c4a47d4ede82f5c56.zip | |
add mobile menu to landing page and make header sticky
| -rw-r--r-- | src/components/LandingHeader.svelte | 66 | ||||
| -rw-r--r-- | src/components/LandingHero.svelte | 2 | ||||
| -rw-r--r-- | src/routes/index.svelte | 33 | ||||
| -rw-r--r-- | static/icons/close.svg | 3 |
4 files changed, 88 insertions, 16 deletions
diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index a8d68462..65ea607c 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -7,14 +7,24 @@ export let howItWorks; export let faq; export let about; + + let showMobileMenu = false; + const mobileMenuButtonClick = (section) => { + showMobileMenu = false; + scroll(section); + }; </script> -<header class="w-full lg:w-5/6 pt-10 mx-auto"> +<header + class="w-full lg:w-5/6 py-5 xl:pb-0 xl:pt-10 mx-auto fixed md:sticky z-10 top-0 bg-white/90" +> <nav class="block xl:flex flex-wrap justify-between items-center"> - <a href="/"> + <a href="/" class="hidden md:block"> <Icon icon="logo" style="mx-auto mb-5 xl:mb-0" /> </a> + <Icon icon="logo" style="block md:hidden ml-5 w-48" /> + <!-- desktop nav --> <div class="hidden space-x-10 md:flex flex-wrap justify-center items-center font-bold"> <button on:click={() => scroll(howItWorks)}>How It Works</button> <button on:click={() => scroll(faq)}>FAQ</button> @@ -43,5 +53,57 @@ </button> {/if} </div> + + <!-- mobile nav --> + <button + class="block md:hidden absolute top-[34.5px] right-10 z" + on:click={() => (showMobileMenu = !showMobileMenu)} + ><Icon icon={!showMobileMenu ? 'menu' : 'close'} /> + </button> + + <div + class="block md:hidden absolute top-0 {showMobileMenu + ? 'right-0' + : 'right-[-100%]'} transition-all ease-in-out duration-300 h-[100vh] w-full bg-white" + > + <div class="space-y-8 mt-24 ml-10 font-bold text-xl"> + <button on:click={() => mobileMenuButtonClick(howItWorks)} class="block" + >How It Works</button + > + <button on:click={() => mobileMenuButtonClick(faq)} class="block">FAQ</button> + <button on:click={() => mobileMenuButtonClick(about)} class="block">About</button> + {#if !$user} + <button + class="border rounded-full px-6 py-2 font-bold block" + on:click={() => goto('/register')} + >Start in Seconds + </button> + <button + class="bg-black text-white border rounded-full px-6 py-2 font-bold block" + on:click={() => goto('/login')} + > + Sign in + </button> + {:else} + <button + class="border rounded-full px-6 py-2 font-bold block" + on:click={() => goto(`/${$user.username}/dashboard`)} + >Account + </button> + <button + class="bg-black text-white border rounded-full px-6 py-2 font-bold block" + on:click={() => goto('/logout')} + > + Sign out + </button> + {/if} + </div> + </div> </nav> </header> + +<style> + .z { + z-index: 100; + } +</style> diff --git a/src/components/LandingHero.svelte b/src/components/LandingHero.svelte index 8fe344d7..93bea8c2 100644 --- a/src/components/LandingHero.svelte +++ b/src/components/LandingHero.svelte @@ -4,7 +4,7 @@ import { user } from '$lib/store'; </script> -<div> +<div class="mt-[96.88px] md:mt-0"> <div class="space-y-10"> <h1 class="text-5xl md:text-6xl lg:text-7xl 2xl:text-8xl font-medium text-center w-full md:w-3/4 lg:w-1/2 max-w-7xl mx-auto leading-tight" diff --git a/src/routes/index.svelte b/src/routes/index.svelte index c823f668..faa881bb 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -53,7 +53,7 @@ <LandingHeader {howItWorks} {faq} {about} /> -<main class="space-y-40 py-20 md:py-32 lg:py-40 px-5 md:px-0"> +<main class="space-y-40 py-20 md:py-32 lg:py-36 xl:py-40 px-5 md:px-0"> <!-- hero --> <LandingHero /> @@ -82,14 +82,17 @@ </LandingInfoCard> <!-- landing info 3 --> - <LandingInfoCard - image="customize" - title="Brand it your way!" - description="Customize your point of sale look and feel, or keep it on default - totally up to you." - /> + <div> + <LandingInfoCard + image="customize" + title="Brand it your way!" + description="Customize your point of sale look and feel, or keep it on default - totally up to you." + /> + <div bind:this={howItWorks} /> + </div> <!-- how it works --> - <div bind:this={howItWorks}> + <div> <h3 class="text-5xl font-medium mb-10 text-center">How it works</h3> <div class="block lg:flex justify-center items-center space-y-10 lg:space-y-0 lg:space-x-10 text-center" @@ -98,18 +101,22 @@ <HowItWorksCard image={step.image} step={step.step} description={step.description} /> {/each} </div> + <div bind:this={faq} /> </div> <!-- faq --> - <div class="space-y-10" bind:this={faq}> - <h3 class="text-5xl font-medium text-center">FAQ</h3> - {#each faqQuestions as question} - <FaqCard question={question.question} answer={question.answer} /> - {/each} + <div> + <div class="space-y-10"> + <h3 class="text-5xl font-medium text-center">FAQ</h3> + {#each faqQuestions as question} + <FaqCard question={question.question} answer={question.answer} /> + {/each} + </div> + <div bind:this={about} /> </div> <!-- about --> - <div bind:this={about}> + <div> <About /> </div> </main> diff --git a/static/icons/close.svg b/static/icons/close.svg new file mode 100644 index 00000000..0fdb37c5 --- /dev/null +++ b/static/icons/close.svg @@ -0,0 +1,3 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M6 18L18 6M6 6L18 18" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> +</svg> |
