-
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.
✨ Added a dedicated Server Components page
- Loading branch information
Showing
6 changed files
with
100 additions
and
0 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 |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"extralight", | ||
"hljs", | ||
"Queryrecent", | ||
"QUICKSTART", | ||
"Roboto" | ||
] | ||
} |
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
13 changes: 13 additions & 0 deletions
13
web/src/pages/ServerComponentsPage/ServerComponentsPage.stories.tsx
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,13 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import ServerComponentsPage from './ServerComponentsPage' | ||
|
||
const meta: Meta<typeof ServerComponentsPage> = { | ||
component: ServerComponentsPage, | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof ServerComponentsPage> | ||
|
||
export const Primary: Story = {} |
14 changes: 14 additions & 0 deletions
14
web/src/pages/ServerComponentsPage/ServerComponentsPage.test.tsx
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 { render } from '@redwoodjs/testing/web' | ||
|
||
import ServerComponentsPage from './ServerComponentsPage' | ||
|
||
// Improve this test with help from the Redwood Testing Doc: | ||
// https://redwoodjs.com/docs/testing#testing-pages-layouts | ||
|
||
describe('ServerComponentsPage', () => { | ||
it('renders successfully', () => { | ||
expect(() => { | ||
render(<ServerComponentsPage />) | ||
}).not.toThrow() | ||
}) | ||
}) |
70 changes: 70 additions & 0 deletions
70
web/src/pages/ServerComponentsPage/ServerComponentsPage.tsx
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,70 @@ | ||
import { useState } from 'react' | ||
|
||
import { Metadata } from '@redwoodjs/web' | ||
|
||
import Icon from 'src/components/Icon/Icon' | ||
import Newsletter from 'src/components/Newsletter/Newsletter' | ||
import { Constants } from 'src/helpers/Constants' | ||
|
||
const ServerComponentsPage = () => { | ||
const [isCopied, setIsCopied] = useState(false) | ||
|
||
const copyToClipboard = () => { | ||
// copy text to clipboard | ||
navigator.clipboard.writeText(Constants.RSC_QUICKSTART) | ||
|
||
// change icon | ||
setIsCopied(true) | ||
|
||
// change the icon back | ||
setTimeout(() => { | ||
setIsCopied(false) | ||
}, 2000) | ||
} | ||
|
||
return ( | ||
<> | ||
<Metadata | ||
title="Server Components" | ||
description="The fastest way to get started with Redwood Server Components" | ||
/> | ||
|
||
<div className="page-content"> | ||
<header className="grid grid-cols-10 gap-5 py-[100px]"> | ||
<div className="col-span-10"> | ||
<h1 className="mb-5 font-serif text-5xl font-bold text-maiTai md:text-7xl"> | ||
Quick Start | ||
</h1> | ||
<h2 className="mb-10 font-sans text-4xl font-thin text-battleshipGray"> | ||
The easiest way to get started with Redwood Server Components | ||
</h2> | ||
<div className="inline-flex h-[53px] items-center justify-between gap-7 rounded-[4px] border-2 border-maiTai px-7"> | ||
<div | ||
contentEditable={true} | ||
className="font-white font-mono text-base leading-none md:text-lg" | ||
> | ||
{Constants.RSC_QUICKSTART} | ||
</div> | ||
<button | ||
onClick={copyToClipboard} | ||
aria-label="copy install command" | ||
> | ||
{isCopied ? ( | ||
<span className="text-sulu"> | ||
<Icon id="check" /> | ||
</span> | ||
) : ( | ||
<span className="text-battleshipGray hover:text-christi dark:hover:text-white"> | ||
<Icon id="clipboard" /> | ||
</span> | ||
)} | ||
</button> | ||
</div> | ||
</div> | ||
</header> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default ServerComponentsPage |