Skip to content

Commit

Permalink
Merge branch 'main' into feat/prevent-recursive-fallback-throw-error
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli authored Jan 23, 2025
2 parents b76170a + 1feeafc commit 6973ced
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/suspensive.org/public/img/icons/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/suspensive.org/public/img/icons/content_copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 7 additions & 18 deletions docs/suspensive.org/src/components/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Image from 'next/image'
import Link from 'next/link'
import { useRouter } from 'nextra/hooks'
import { useEffect, useRef } from 'react'
import { NpmInstallCopyButton } from './NpmInstallCopyButton'

const CodeBlockClassName = 'nextra-code'

Expand All @@ -16,13 +17,12 @@ const backtickToCodeBlock = (text: string) =>
const formatCodeBlocks = (desc: string) => backtickToCodeBlock(escapeHtml(desc))

export const HomePage = ({
description,
title,
buttonText,
items,
children,
}: {
title: string
description: string
buttonText: string
items: { title: string; desc: string }[]
version: number
Expand Down Expand Up @@ -60,26 +60,15 @@ export const HomePage = ({
/>
</div>
<div className="flex flex-col items-center gap-4">
<div className="break-keep px-4 text-4xl font-bold leading-tight md:text-6xl">
<span>{description}</span>
<div className="break-keep bg-gradient-to-r from-white via-white/80 to-white/60 bg-clip-text px-4 text-4xl font-bold leading-tight text-transparent md:text-6xl">
<span>{title}</span>
</div>
<motion.p
initial={{ opacity: 0 }}
animate={{
opacity: 0.6,
transition: { delay: 0.1, duration: 1 },
}}
className="rounded-full text-lg text-white md:text-xl"
>
npm i @suspensive/react
</motion.p>
</div>
<NpmInstallCopyButton />
</div>
<Link href={`/${router.locale}/docs/react/motivation`}>
<motion.button
whileHover={{
scale: 1.05,
}}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
initial={{ opacity: 0 }}
animate={{
Expand All @@ -92,7 +81,7 @@ export const HomePage = ({
'drop-shadow(0 0 1px rgba(255, 255, 255, 0.5)) drop-shadow(0 0 3px rgba(255, 255, 255, 0.5)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.5))',
}}
type="button"
className="rounded-xl bg-white px-8 py-3 text-lg font-bold text-[#111111] md:px-10 md:py-3 md:text-xl"
className="rounded-xl bg-white px-7 py-2 text-lg font-bold text-[#111111] md:px-9 md:py-3 md:text-xl"
>
{buttonText}
</motion.button>
Expand Down
46 changes: 46 additions & 0 deletions docs/suspensive.org/src/components/NpmInstallCopyButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { AnimatePresence, motion } from 'motion/react'
import '../styles/globals.css'
import Image from 'next/image'
import { useState } from 'react'
import checkSVG from '../../public/img/icons/check.svg'
import content_copySVG from '../../public/img/icons/content_copy.svg'

const npmInstallScript = 'npm i @suspensive/react'
export const NpmInstallCopyButton = () => {
const [isHovered, setIsHovered] = useState(false)
const [isClicked, setIsClicked] = useState(false)

return (
<motion.button
className="relative mt-4 flex cursor-copy"
type="button"
onHoverStart={() => setIsHovered(true)}
onHoverEnd={() => {
setIsHovered(false)
setIsClicked(false)
}}
whileHover={{ opacity: 1 }}
initial={{ opacity: 0 }}
animate={{ opacity: 0.5 }}
onClick={() => {
navigator.clipboard.writeText(npmInstallScript)
setIsClicked(true)
}}
>
~ {npmInstallScript}
<motion.div className="absolute -right-8 flex items-center justify-center">
<AnimatePresence>
{isHovered ? (
<motion.span
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
<Image src={isClicked ? checkSVG : content_copySVG} alt="" />
</motion.span>
) : null}
</AnimatePresence>
</motion.div>
</motion.button>
)
}
2 changes: 1 addition & 1 deletion docs/suspensive.org/src/pages/en/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@/components'

<HomePage
description="All in one for React Suspense"
title="All in one for React Suspense"
buttonText="Get Started"
items={[
{
Expand Down
2 changes: 1 addition & 1 deletion docs/suspensive.org/src/pages/ko/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@/components'

<HomePage
description="React Suspense를 위한 모든 것"
title="React Suspense를 위한 모든 것"
buttonText="시작하기"
items={[
{
Expand Down
1 change: 1 addition & 0 deletions docs/suspensive.org/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '*.svg'
1 change: 1 addition & 0 deletions docs/suspensive.org/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"include": [
"next-env.d.ts",
"svg.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
Expand Down

0 comments on commit 6973ced

Please sign in to comment.