Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added example: with-geist-ui #36525

Merged
merged 7 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions examples/with-geist-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
21 changes: 21 additions & 0 deletions examples/with-geist-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Example app with [geist-ui](https://github.com/geist-org/geist-ui) and TypeScript

This example features how to use [geist-ui](https://github.com/geist-org/geist-ui) as the component library within a Next.js app with TypeScript.

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-geist-ui)

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-geist-ui&project-name=with-geist-ui&repository-name=with-geist-ui)

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:

```bash
npx create-next-app --example with-geist-ui with-geist-ui-app
# or
yarn create next-app --example with-geist-ui with-geist-ui-app
# or
pnpm create next-app -- --example with-geist-ui with-geist-ui-app
```

Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
5 changes: 5 additions & 0 deletions examples/with-geist-ui/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
22 changes: 22 additions & 0 deletions examples/with-geist-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"private": true,
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@geist-ui/core": "latest",
"@geist-ui/icons": "1.0.1",
"next": "latest",
"react": "^18.1.0",
"react-dom": "^18.1.0"
},
"devDependencies": {
"@types/node": "^17.0.29",
"@types/react": "^18.0.8",
"eslint": "8.14.0",
"eslint-config-next": "12.1.5",
"typescript": "^4.5.4"
}
}
12 changes: 12 additions & 0 deletions examples/with-geist-ui/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { AppProps } from 'next/app'
import { GeistProvider, CssBaseline } from '@geist-ui/core'

function MyApp({ Component, pageProps }: AppProps) {
return (
<GeistProvider>
<CssBaseline />
<Component {...pageProps} />
</GeistProvider>
)
}
export default MyApp
33 changes: 33 additions & 0 deletions examples/with-geist-ui/pages/_document.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { CssBaseline } from '@geist-ui/core'

class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
const styles = CssBaseline.flush()

return {
...initialProps,
styles: (
<>
{initialProps.styles}
{styles}
</>
),
}
}

render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}

export default MyDocument
87 changes: 87 additions & 0 deletions examples/with-geist-ui/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import Head from 'next/head'
import {
Page,
Text,
Image,
Display,
Button,
Grid,
Spacer,
} from '@geist-ui/core'
import { Github } from '@geist-ui/icons'

const gh = 'https://github.com/geist-org/geist-ui'
const docs = 'https://geist-ui.dev'

export default function Home() {
const redirect = (url: string) => window.open(url)

return (
<div>
<Head>
<title>Geist UI with NextJS</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<Page dotBackdrop width="800px" padding={0}>
<Display
title="Geist UI"
caption={
<>
Example repository of{' '}
<Text span b>
Next.js
</Text>{' '}
&{' '}
<Text b i style={{ letterSpacing: '0.6px' }}>
<Text span type="success">
G
</Text>
<Text span type="warning">
e
</Text>
<Text span type="secondary">
i
</Text>
<Text span type="error">
s
</Text>
<Text span style={{ color: '#ccc' }}>
t
</Text>
<Text span type="success" ml="5px">
UI.
</Text>
</Text>{' '}
</>
}
>
<Image
src="/geist-banner.png"
alt="geist ui banner"
draggable={false}
/>
</Display>
<Grid.Container justify="center" gap={3} mt="100px">
<Grid xs={20} sm={7} justify="center">
<Button
shadow
type="secondary-light"
width="100%"
onClick={() => redirect(gh)}
>
<Github size={20} />
<Spacer inline w={0.35} />
GitHub Repo
</Button>
</Grid>
<Grid xs={0} sm={3} />
<Grid xs={20} sm={7} justify="center">
<Button width="100%" onClick={() => redirect(docs)}>
Documentation Site
</Button>
</Grid>
</Grid.Container>
</Page>
</div>
)
}
Binary file added examples/with-geist-ui/public/geist-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions examples/with-geist-ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}