@@ -3,8 +3,12 @@ import GithubIcon from "@/components/icons/GithubIcon";
33import Layout from "@/layout/Layout" ;
44import { LANGUAGES , THEMES } from "@/lib/constants" ;
55import { PlusCircleIcon } from "@heroicons/react/24/outline" ;
6+ import { useRouter } from "next/router" ;
7+ import { useEffect } from "react" ;
68
79export default function Home ( ) {
10+ const router = useRouter ( ) ;
11+
812 const focusOnGenerate = ( ) => {
913 let codeArea = document . getElementById ( "snippng-code-area" ) ;
1014 if ( codeArea ) {
@@ -13,6 +17,21 @@ export default function Home() {
1317 } ) ;
1418 }
1519 } ;
20+
21+ useEffect ( ( ) => {
22+ if ( ! router . isReady ) return ;
23+ let timer : NodeJS . Timeout ;
24+ let goToEditor = router . asPath . split ( "#" ) . includes ( "snippng-code-area" ) ;
25+ if ( goToEditor ) {
26+ timer = setTimeout ( ( ) => {
27+ focusOnGenerate ( ) ;
28+ } , 200 ) ;
29+ }
30+ return ( ) => {
31+ clearTimeout ( timer ) ;
32+ } ;
33+ } , [ router . isReady ] ) ;
34+
1635 return (
1736 < Layout >
1837 < div data-testid = "landing-container" className = "bg-transparent" >
@@ -43,7 +62,7 @@ export default function Home() {
4362 </ svg >
4463 </ div >
4564 < div className = "relative isolate overflow-hidden" >
46- < div className = "mx-auto max-w-7xl pt-10 pb-24 sm:pb-32 lg:grid lg:grid-cols-2 lg:gap-x-8 lg:py-20 " >
65+ < div className = "mx-auto max-w-7xl pt-10 pb-24 sm:pb-32 lg:grid lg:grid-cols-2 lg:gap-x-8 lg:py-12 " >
4766 < div className = "lg:pt-4" >
4867 < div className = "mx-auto max-w-2xl" >
4968 < div className = "max-w-lg" >
@@ -81,9 +100,10 @@ export default function Home() {
81100 Snippng
82101 </ h1 >
83102 < p className = "mt-6 md:text-lg text-sm dark:text-zinc-300 text-zinc-600" >
84- Create and share beautiful images of your source code. Start
85- typing or paste a code snippet into the text area to get
86- started.
103+ Write, customize and download gorgeous images of your code
104+ snippet. Beautifully designed application that helps you
105+ generate beautiful and customizable images of your code
106+ snippets.
87107 </ p >
88108 < div className = "mt-10 flex md:flex-row flex-col md:items-center items-start gap-6 ml-1" >
89109 < Button
0 commit comments