-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding docs for getting started and all components (#3)
* π Add proper layout for gradient in bg * π οΈ Change prettier code format flow in scripts * π Add code block component for docs * π Add steps for project setup and config * π¨ Code format using prettier * π Docs layout <> Button code docs v1 * π¨ Prettier code format * π₯ Remove prettier format after package/registry updates * π¨ Prettier code format * πΈ Improve project setup flow
- Loading branch information
1 parent
ba79a15
commit 4bb7e0d
Showing
27 changed files
with
2,033 additions
and
464 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ComponentDocsHeader from '@/components/website/component-docs-header'; | ||
import { SETUP_CODE } from '@/package/registry/setup-code.tsx'; | ||
import { CodeBlock } from '@/components/website/code-block.tsx'; | ||
|
||
<ComponentDocsHeader /> | ||
|
||
<CodeBlock hasViewMore fileName={SETUP_CODE['button'].registerAt}> | ||
{SETUP_CODE['button'].code} | ||
</CodeBlock> |
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,14 @@ | ||
import { ResponsiveControl } from '@/components/layouts/responsive-control'; | ||
import { ReactNode } from 'react'; | ||
|
||
export default function ComponentDocsLayout({ | ||
children, | ||
}: { | ||
children: ReactNode; | ||
}) { | ||
return ( | ||
<div className="component-docs-layout markdown-content"> | ||
<ResponsiveControl className="">{children}</ResponsiveControl> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Button } from '@/components/ui/button'; | ||
import { ReactNode } from 'react'; | ||
|
||
export type ComponentListItemType = { | ||
name: string; | ||
description: string; | ||
path: string; | ||
render: ReactNode; | ||
}; | ||
export const ComponentsList: ComponentListItemType[] = [ | ||
{ | ||
name: 'Button', | ||
description: | ||
'A framer-motion supported button with size and design variants.', | ||
path: '/components/button', | ||
render: <Button>Button</Button>, | ||
}, | ||
]; |
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 { PageHeader } from '@/components/layouts/page-header'; | ||
import { ResponsiveControl } from '@/components/layouts/responsive-control'; | ||
import { ComponentBlock } from '@/components/website/component-block'; | ||
import { | ||
ComponentListItemType, | ||
ComponentsList, | ||
} from './common/components-list'; | ||
|
||
export default function ComponentsPage() { | ||
return ( | ||
<div className="components-page relative z-50"> | ||
<PageHeader> | ||
<ResponsiveControl> | ||
<h2 className="font-semibold text-6xl">{'Components'}</h2> | ||
</ResponsiveControl> | ||
</PageHeader> | ||
<div className="components-list-container mt-12"> | ||
<ResponsiveControl className="grid grid-cols-3 gap-6"> | ||
{ComponentsList.map( | ||
(component: ComponentListItemType, index: number) => { | ||
return ( | ||
<ComponentBlock | ||
key={index} | ||
componentData={component} | ||
animationThreshold={index} | ||
/> | ||
); | ||
}, | ||
)} | ||
</ResponsiveControl> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { SetupSection } from '@/components/sections/setup-section'; | ||
|
||
export default async function GettingStarted() { | ||
return ( | ||
<div className="getting-started-page"> | ||
<SetupSection /> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ body { | |
} | ||
|
||
html { | ||
@apply bg-black; | ||
@apply bg-neutral-900; | ||
} | ||
|
||
body { | ||
|
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,5 @@ | ||
export const SetupSectionContent = { | ||
headline: 'Project Setup and Configurations', | ||
description: | ||
"In order to use the components and cookies you must have the following dependencies and configs in your project. Here's a step-by-step setup guide.", | ||
}; |
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,18 @@ | ||
import { cn } from '@/helpers/utils'; | ||
import { forwardRef } from 'react'; | ||
|
||
export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {} | ||
|
||
export const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>( | ||
({ className, ...args }, ref) => { | ||
return ( | ||
<header | ||
ref={ref} | ||
className={cn('my-24 relative border-y border-white/10', className)} | ||
{...args} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
PageHeader.displayName = 'PageHeader'; |
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,132 @@ | ||
import { SetupSectionContent } from '@/common/content'; | ||
import { ResponsiveControl } from '../layouts/responsive-control'; | ||
import { forwardRef } from 'react'; | ||
import { cn } from '@/helpers/utils'; | ||
import { PageHeader } from '../layouts/page-header'; | ||
import { Button } from '../ui/button'; | ||
import { CodeBlock } from '../website/code-block'; | ||
import { SETUP_CODE } from '@/package/registry/setup-code'; | ||
import Link from 'next/link'; | ||
|
||
type SetupStepType = { | ||
title: string; | ||
description: string; | ||
action?: { | ||
name: string; | ||
path: string; | ||
}; | ||
code?: | ||
| string | ||
| { | ||
content: string; | ||
fileName: string; | ||
}; | ||
}; | ||
|
||
export interface SetupSectionProps | ||
extends React.HTMLAttributes<HTMLDivElement> {} | ||
|
||
export interface SetupStepContainerProps | ||
extends React.HTMLAttributes<HTMLDivElement> { | ||
stepContent: SetupStepType; | ||
stepIndex: number; | ||
} | ||
|
||
const SetupData: SetupStepType[] = [ | ||
{ | ||
title: 'Have a basic NextJS + Typescript + Tailwind project setup', | ||
description: | ||
'The setup is going to require a NextJS app with Typescript & Tailwind. Make sure you have a simple project setup, If you have it already, you can go to the next step.', | ||
code: `# using npm \nnpx create-next-app app-name \n\n# using yarn \nyarn create next-app app-name`, | ||
}, | ||
{ | ||
title: 'Installing dependencies', | ||
description: | ||
'All the cookies, components and required utilities are using various npm dependencies. Install them as your first step to get started.', | ||
code: 'yarn add lucide-react framer-motion clsx tailwind-merge', | ||
}, | ||
{ | ||
title: 'Add configuration for animations', | ||
description: | ||
'The configurations are going to provide basic animations to your components. You can customize and add custom animations in this code.', | ||
code: { | ||
content: SETUP_CODE['animation-config'].code, | ||
fileName: SETUP_CODE['animation-config'].registerAt, | ||
}, | ||
}, | ||
{ | ||
title: 'Add cn() as to helpers', | ||
description: | ||
'Components are using cn() to combine the classNames, supporting tailwind-merge. All thanks to shadcn for writing this.', | ||
code: { | ||
content: SETUP_CODE.utils.code, | ||
fileName: SETUP_CODE.utils.registerAt, | ||
}, | ||
}, | ||
]; | ||
|
||
export const SetupSection = forwardRef<HTMLDivElement, SetupSectionProps>( | ||
({ className, ...args }, ref) => { | ||
return ( | ||
<section ref={ref} className={cn('setup-section')} id="setup" {...args}> | ||
<PageHeader> | ||
<ResponsiveControl className={cn('relative', className)}> | ||
<h2 className="font-semibold text-4xl"> | ||
{SetupSectionContent.headline} | ||
</h2> | ||
<div className="setup-description-wrapper mt-4"> | ||
<p className="w-[56ch] opacity-60"> | ||
{SetupSectionContent.description} | ||
</p> | ||
</div> | ||
<div className="next-step-actions-wrapper mt-6"> | ||
<Link href={'/components'}> | ||
<Button withArrow>Explore Components</Button> | ||
</Link> | ||
</div> | ||
</ResponsiveControl> | ||
</PageHeader> | ||
<div className="mt-12 setup-steps-container"> | ||
<ResponsiveControl className="grid grid-cols-1 items-start gap-36"> | ||
{SetupData.map((setup, index) => { | ||
return ( | ||
<SetupStepContainer | ||
key={index} | ||
stepContent={setup} | ||
stepIndex={index} | ||
/> | ||
); | ||
})} | ||
</ResponsiveControl> | ||
</div> | ||
</section> | ||
); | ||
}, | ||
); | ||
|
||
SetupSection.displayName = 'SetupSection'; | ||
|
||
export const SetupStepContainer = forwardRef< | ||
HTMLDivElement, | ||
SetupStepContainerProps | ||
>(({ className, stepContent, stepIndex, ...args }, ref) => { | ||
return ( | ||
<div ref={ref} className={cn('setup-step-container relative')} {...args}> | ||
<div className="setup-step-body flex flex-row items-start gap-6"> | ||
<div className="setup-step-body-content-wrapper flex flex-col items-start gap-2 w-[600px] sticky top-12"> | ||
<h3 className="text-xl font-medium">{stepContent.title}</h3> | ||
<p className="text-white/50 mt-2">{stepContent.description}</p> | ||
</div> | ||
{typeof stepContent.code === 'string' ? ( | ||
<CodeBlock>{stepContent.code}</CodeBlock> | ||
) : ( | ||
<CodeBlock fileName={stepContent.code?.fileName} hasViewMore> | ||
{stepContent.code?.content} | ||
</CodeBlock> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}); | ||
|
||
SetupStepContainer.displayName = 'SetupStepContainer'; |
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
Oops, something went wrong.