File tree Expand file tree Collapse file tree 1 file changed +0
-48
lines changed
Expand file tree Collapse file tree 1 file changed +0
-48
lines changed Original file line number Diff line number Diff line change 11<script >
2- import Button from " ../Button.svelte" ;
3- import Icon from " ../Icon.svelte" ;
4-
52 let navState = false ;
6- const links = [{ href: " #home" , text: " Home" }];
73
84 function closeNav () {
95 navState = false ;
2117 class:hidden ={! navState }
2218 class =" fixed inset-0 z-10 bg-gray-900 opacity-50 sm:hidden hidden"
2319 />
24-
25- <Button class ="m-0 ml-2 block sm:hidden" on:click ={() => (navState = true )}>
26- <Icon class =" text-xl" name =" bars" />
27- </Button >
28-
29- <nav class:open ={navState }>
30- <Button class ="sm:hidden block ml-auto" on:click ={closeNav }>
31- <Icon class =" text-2xl" name =" times" />
32- </Button >
33- <ul >
34- {#each links as link }
35- <li ><a on:click ={closeNav } href ={link .href }>{link .text }</a ></li >
36- {/each }
37- </ul >
38- </nav >
3920 </div >
4021</header >
41-
42- <style lang =" scss" >
43- nav {
44- @apply fixed
45- sm :static
46- inset- y- 0
47- right- 0
48- sm:w- auto
49- w- [256px ]
50- transform
51- translate- x- full
52- sm:translate- x- 0
53- transition
54- duration- 200
55- sm:block
56- bg- white
57- z- 20;
58-
59- & .open {
60- @apply block
61- translate-x- 0
62- ease-out ;
63- }
64-
65- & ul li a {
66- @apply block py-2 .5 px-4 font-medium hover :text- primary- 600;
67- }
68- }
69- </style >
You can’t perform that action at this time.
0 commit comments