-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: carousel & search icon & hovers
- Loading branch information
Showing
12 changed files
with
168 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {useEffect, useRef, useState} from 'react'; | ||
import {motion} from 'framer-motion'; | ||
|
||
import {FeaturedApp} from './FeaturedApp'; | ||
|
||
import type {TApp} from 'pages/home/[category]'; | ||
import type {ReactElement} from 'react'; | ||
|
||
export function AppsCarousel(props: {apps: TApp[]}): ReactElement { | ||
const targetRef = useRef<HTMLDivElement | null>(null); | ||
const [width, set_width] = useState(0); | ||
|
||
useEffect(() => { | ||
set_width(Number(targetRef.current?.scrollWidth) - Number(targetRef.current?.offsetWidth)); | ||
}, []); | ||
|
||
return ( | ||
<section | ||
ref={targetRef} | ||
className={'relative'}> | ||
<motion.div | ||
drag={'x'} | ||
dragConstraints={{ | ||
right: 0, | ||
left: -width | ||
}} | ||
className={'flex gap-x-6'}> | ||
{props.apps.map(app => ( | ||
<FeaturedApp app={app} /> | ||
))} | ||
</motion.div> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
import {IconShare} from '@common/icons/IconShare'; | ||
|
||
import type {TApp} from 'pages/home/[category]'; | ||
import type {ReactElement} from 'react'; | ||
|
||
export function FeaturedApp(props: {app: TApp}): ReactElement { | ||
return ( | ||
<div | ||
className={ | ||
'relative flex w-full flex-col justify-end bg-center px-6 py-10 outline outline-1 outline-gray-800/50 lg:h-[520px]' | ||
} | ||
style={{ | ||
backgroundImage: `url(${props.app.image})` | ||
}}> | ||
'group relative flex w-full cursor-pointer flex-col justify-end overflow-hidden px-6 py-10 outline outline-1 outline-gray-500/50 lg:h-[520px] lg:min-w-[384px]' | ||
}> | ||
<div | ||
style={{ | ||
backgroundImage: `url(${props.app.image})` | ||
}} | ||
className={'absolute right-0 top-0 size-full bg-center transition-all group-hover:scale-105'} | ||
/> | ||
<div | ||
className={ | ||
'absolute right-2 top-2 hidden size-10 items-center justify-center bg-gray-900 transition-all group-hover:flex' | ||
}> | ||
<IconShare className={'size-[10px]'} /> | ||
</div> | ||
<div | ||
style={{background: 'linear-gradient(180deg, rgba(12, 12, 12, 0) 0%, #0C0C0C 100%)'}} | ||
className={'absolute left-0 top-0 size-full'} | ||
className={'absolute left-0 top-0 size-full group-hover:scale-105'} | ||
/> | ||
<p className={'z-20 text-xl font-bold text-white'}>{props.app.title}</p> | ||
<p className={'z-20 hidden text-gray-400 group-hover:block'}>{props.app.description}</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type {ReactElement} from 'react'; | ||
|
||
export function IconEnter(props: React.SVGProps<SVGSVGElement>): ReactElement { | ||
return ( | ||
<svg | ||
{...props} | ||
width={'12'} | ||
height={'12'} | ||
viewBox={'0 0 12 12'} | ||
fill={'none'} | ||
xmlns={'http://www.w3.org/2000/svg'}> | ||
<g clip-path={'url(#clip0_2013_717)'}> | ||
<path | ||
d={'M4 5L1 8L4 11'} | ||
stroke={'#9D9D9D'} | ||
strokeWidth={'1.5'} | ||
strokeLinecap={'round'} | ||
strokeLinejoin={'round'} | ||
/> | ||
<path | ||
d={'M6 1H9C10.1046 1 11 1.89543 11 3V6C11 7.10457 10.1046 8 9 8H2'} | ||
stroke={'#9D9D9D'} | ||
strokeWidth={'1.5'} | ||
strokeLinecap={'round'} | ||
strokeLinejoin={'round'} | ||
/> | ||
</g> | ||
<defs> | ||
<clipPath id={'clip0_2013_717'}> | ||
<rect | ||
width={'12'} | ||
height={'12'} | ||
fill={'white'} | ||
/> | ||
</clipPath> | ||
</defs> | ||
</svg> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters