Skip to content

Commit 5b5dfd8

Browse files
committed
feat: add responsive
1 parent 6e26d50 commit 5b5dfd8

File tree

8 files changed

+33
-71
lines changed

8 files changed

+33
-71
lines changed

.prettierrc.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
2-
"bracketSpacing": true,
3-
"jsxSingleQuote": false,
4-
"printWidth": 120,
5-
"proseWrap": "always",
6-
"semi": false,
7-
"singleQuote": true,
8-
"tabWidth": 2,
9-
"trailingComma": "all"
10-
}
11-
2+
"bracketSpacing": true,
3+
"jsxSingleQuote": false,
4+
"printWidth": 360,
5+
"proseWrap": "always",
6+
"semi": false,
7+
"singleQuote": true,
8+
"tabWidth": 2,
9+
"trailingComma": "all"
10+
}

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ onMounted(() => {
4444
<div ref="DOMSiteloader" class="fixed top-0 left-0 right-0 bottom-0 z-max bg-dark"></div>
4545
<main class="js-main flex flex-col justify-between min-h-screen">
4646
<Header />
47-
<section class="px-20 w-full grid grid-cols-12">
48-
<h1 class="col-span-5 font-termina text-700" ref="DOMTitle">Welcome to Faucet Hub</h1>
47+
<section class="px-4 md:px-14 lg:px-20 mx-auto max-w-[110rem] w-full grid grid-cols-12">
48+
<h1 class="col-span-12 lg:col-span-5 font-termina text-600 md:text-700 text-center md:text-left" ref="DOMTitle">Welcome to Faucet Hub</h1>
4949
<FaucetsList />
5050
</section>
5151

src/components/faucet/FaucetCard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import { computed } from 'vue'
1414
import Card from '@/components/ui/Card.vue'
1515
import FaucetAvailability from './FaucetAvailability.vue'
1616
17-
import { MotionTracker } from '@/composables/useMouseDelegation'
17+
import { type MotionTracker } from '@/composables/useMouseDelegation'
1818
1919
import { Faucet } from '@/types'
2020
2121
interface Props {
2222
faucet: Faucet
23-
motion: MotionTracker
23+
motion?: MotionTracker
2424
isLoading: boolean
2525
}
2626

src/components/faucet/FaucetDetail.vue

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
<template>
2-
<div
3-
ref="DOMbackground"
4-
class="fixed w-screen h-screen top-0 left-0 z-30 bg-darkblur backdrop-blur-sm invisible opacity-0"
5-
></div>
2+
<div ref="DOMbackground" class="fixed w-screen h-screen top-0 left-0 z-30 bg-darkblur backdrop-blur-sm invisible opacity-0"></div>
63

74
<section
85
ref="DOMpopup"
9-
class="popup fixed flex flex-col items-center rounded w-[36rem] bg-grey-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[1000] justify-center text-grey-50 before:absolute before:top-0 before:bottom-0 before:left-0 before:right-0 before:rounded before:bg-500 before:z-min after:absolute after:top-px after:left-px after:bottom-px after:right-px after:bg-grey-500 after:rounded after:z-min"
6+
class="popup fixed flex flex-col items-center rounded w-[90vw] max-w-[36rem] bg-grey-300 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[1000] justify-center text-grey-50 before:absolute before:top-0 before:bottom-0 before:left-0 before:right-0 before:rounded before:bg-500 before:z-min after:absolute after:top-px after:left-px after:bottom-px after:right-px after:bg-grey-500 after:rounded after:z-min"
107
>
118
<div ref="DOMFaucetRequest" class="p-12">
12-
<FaucetContentForm
13-
:name="store.selectedFaucet.name ?? 'Faucet'"
14-
:options="store.faucetAmount"
15-
v-show="store.contentStep === 0"
16-
class="js-faucetform opacity-100"
17-
:error="error"
18-
@requestFaucet="requestFaucet"
19-
/>
9+
<FaucetContentForm :name="store.selectedFaucet.name ?? 'Faucet'" :options="store.faucetAmount" v-show="store.contentStep === 0" class="js-faucetform opacity-100" :error="error" @requestFaucet="requestFaucet" />
2010
<div>
2111
<div ref="gnoRequestLogo" v-show="store.contentStep >= 1" class="opacity-0">
2212
<Vue3Lottie :animationData="GnoJSON" :loop="true" :height="200" :width="200" :autoPlay="true" />
2313
</div>
2414
<FaucetContentRequest v-show="store.contentStep === 1" class="js-faucetpending" />
25-
<FaucetContentSuccess
26-
v-show="store.contentStep === 2"
27-
:tx-link="txLink"
28-
class="js-faucetsuccess opacity-0"
29-
@doneFaucet="donefaucet()"
30-
/>
15+
<FaucetContentSuccess v-show="store.contentStep === 2" :tx-link="txLink" class="js-faucetsuccess opacity-0" @doneFaucet="donefaucet()" />
3116
</div>
3217
</div>
3318
</section>
@@ -190,11 +175,6 @@ watch(
190175
}
191176
.popup::before {
192177
opacity: var(--op);
193-
background: radial-gradient(
194-
farthest-corner circle at var(--mx, 0%) var(--my, 100%),
195-
#aeffb6 0%,
196-
#121212 20%,
197-
#121212 100%
198-
);
178+
background: radial-gradient(farthest-corner circle at var(--mx, 0%) var(--my, 100%), #aeffb6 0%, #121212 20%, #121212 100%);
199179
}
200180
</style>

src/components/faucet/FaucetsList.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
11
<template>
22
<div ref="projectCarouselEL" class="col-span-12 my-20">
33
<Carousel name="Carousel">
4-
<li
5-
v-for="(faucet, idx) in faucets"
6-
:key="idx"
7-
class="js-card p-4 flex-none w-full"
8-
role="group"
9-
aria-roledescription="slide"
10-
>
4+
<li v-for="(faucet, idx) in faucets" :key="idx" class="js-card p-4 flex-none w-full" role="group" aria-roledescription="slide">
115
<div ref="cards" class="translate-x-12 opacity-0 h-full" @click.prevent="openFaucet(faucet)">
12-
<FaucetCard
13-
:data-ref="motions[idx].value.id"
14-
:motion="motions[idx]"
15-
:data-index="idx"
16-
:faucet="faucet"
17-
:is-loading="isLoading"
18-
/>
6+
<FaucetCard :data-ref="motions[idx].value.id" :motion="width >= 768 ? motions[idx] : undefined" :data-index="idx" :faucet="faucet" :is-loading="isLoading" />
197
</div>
208
</li>
219
</Carousel>
@@ -31,6 +19,8 @@ import FaucetCard from '@/components/faucet/FaucetCard.vue'
3119
import { useMouseDelegation } from '@/composables/useMouseDelegation'
3220
import { useFaucetDetail } from '@/stores/faucetDetail'
3321
22+
import { useWindowSize } from '@vueuse/core'
23+
3424
import { Faucet } from '@/types'
3525
3626
// TODO: Top replace with real data
@@ -43,6 +33,8 @@ const cards = ref<null | HTMLElement[]>(null)
4333
// TODO: To custom with async data
4434
let isLoading = false
4535
36+
const { width } = useWindowSize()
37+
4638
const { motions } = useMouseDelegation(projectCarouselEL, faucets, 'ref')
4739
4840
const store = useFaucetDetail()

src/components/layout/Footer.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<template>
2-
<footer class="px-20 mb-12 w-full flex text-grey-100 text-100 justify-between items-center">
3-
<div>
4-
Faucet Hub is a community project.<br />Check out
5-
<a href="https://github.com/gnolang/gno" class="hover:text-grey-50 transition-colors ease-in-out underline"
6-
>Github Repo</a
7-
>.
8-
</div>
9-
<div class="flex items-center">
10-
<div class="mr-6">Learn more about Gno.land <br />and be part of the conversation:</div>
2+
<footer class="px-4 md:px-14 lg:px-20 mb-12 w-full max-w-[110rem] mx-auto flex flex-col md:flex-row text-grey-100 text-100 text-center md:text-left justify-between items-center">
3+
<div class="mb-10 md:mb-0">Faucet Hub is a community project.<br />Check out <a href="https://github.com/gnolang/gno" class="hover:text-grey-50 transition-colors ease-in-out underline">Github Repo</a>.</div>
4+
<div class="flex flex-col md:flex-row items-center">
5+
<div class="mr-6 mb-6 md:mb-0">Learn more about Gno.land <br />and be part of the conversation:</div>
116
<ul class="flex space-x-4">
127
<li v-for="(social, idx) in socials" :key="idx">
138
<a :href="social.link" class="hover:text-grey-50 transition-colors ease-in-out">

src/components/layout/Header.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import IconGnoland from '@/components/icons/IconGnoland.vue'
33
</script>
44

55
<template>
6-
<header class="flex container pt-8 pb-4 mb-16">
7-
<IconGnoland />
6+
<header class="flex w-full max-w-[110rem] mx-auto px-4 md:px-14 lg:px-20 pt-8 pb-4 mb-8 md:mb-16">
7+
<IconGnoland class="m-auto md:m-0" />
88
</header>
99
</template>

src/components/ui/Carousel.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
<template>
22
<section :aria-label="name" aria-roledescription="carousel" class="min-h-[27.5rem] md:min-h-0">
33
<div
4-
class="absolute md:relative -left-20 py-36 -my-36 md:py-0 md:my-0 w-full snap-x flex md:w-screen before:absolute before:w-20 before:h-full before:bg-gradient-to-r before:from-dark before:z-30 after:absolute after:w-20 after:h-full after:bg-gradient-to-l after:from-dark after:right-0 after:z-30"
4+
class="relative md:-left-20 md:py-0 md:my-0 w-full md:snap-x flex md:w-[calc(100%_+_theme(spacing.20))] before:hidden md:before:block before:absolute before:w-20 before:h-full before:bg-gradient-to-r before:from-dark before:z-30 after:hidden md:after:block after:absolute after:w-20 after:h-full after:bg-gradient-to-l after:from-dark after:right-0 after:z-30"
55
>
6-
<ul
7-
id="carousel-items"
8-
aria-live="polite"
9-
class="flex scroller scroller-wrap snap-x snap-mandatory scroll-px-20 md:px-20 py-10 px-0 overflow-x-auto"
10-
>
6+
<ul id="carousel-items" aria-live="polite" class="flex flex-col md:flex-row scroller scroller-wrap snap-x snap-mandatory w-full scroll-px-20 md:px-20 md:py-10 px-0 overflow-x-auto">
117
<slot />
128
</ul>
139
</div>
@@ -33,6 +29,6 @@ const props = withDefaults(defineProps<Props>(), {
3329
}
3430
3531
.scroller-wrap > * {
36-
@apply snap-start md:w-[calc(25%_-_theme(spacing.4))];
32+
@apply snap-start w-full md:w-[calc(50%_-_theme(spacing.4))] lg:w-[calc(33.33%_-_theme(spacing.4))] 2xl:w-[calc(25%_-_theme(spacing.4))];
3733
}
3834
</style>

0 commit comments

Comments
 (0)