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

example: with-mantine #34591

Merged
merged 11 commits into from Sep 30, 2022
9 changes: 4 additions & 5 deletions examples/with-mantine/.gitignore
Expand Up @@ -23,13 +23,12 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

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

# vercel
.vercel

# typescript
*.tsbuildinfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file looks already correct to me.

22 changes: 15 additions & 7 deletions examples/with-mantine/README.md
@@ -1,23 +1,31 @@
# TypeScript & Mantine Next.js example
# Example app with mantine

This is a simple project that shows the usage of Next.js with TypeScript and Mantine.
This example features how you use [mantine](https://github.com/mantine/mantine), a React component library.

## Preview

Preview the example live on [StackBlitz](http://stackblitz.com/):

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-mantine)

## 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-typescript-mantine)
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not change, to align with the other examples

balazsorban44 marked this conversation as resolved.
Show resolved Hide resolved

[![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-typescript-mantine&project-name=with-typescript-mantine&repository-name=with-typescript-mantine)
[![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-mantine&project-name=with-mantine&repository-name=with-mantine)
balazsorban44 marked this conversation as resolved.
Show resolved Hide resolved

## How to use it?
## How to use

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-mantine with-mantine-app
# or
yarn create next-app --example with-mantine with-mantine-app
# or
pnpm create next-app -- --example with-mantine with-mantine-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)).

### Try it on CodeSandbox

[Open this example on CodeSandbox](https://codesandbox.io/s/github/vercel/next.js/tree/canary/examples/with-mantine)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not change to align with the other examples.

balazsorban44 marked this conversation as resolved.
Show resolved Hide resolved
26 changes: 26 additions & 0 deletions examples/with-mantine/pages/_app.js
@@ -0,0 +1,26 @@
import Head from 'next/head';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a _app.tsx file

import { MantineProvider } from '@mantine/core';

export default function App(props) {
const { Component, pageProps } = props;

return (
<>
<Head>
<title>Page title</title>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
</Head>

<MantineProvider
withGlobalStyles
withNormalizeCSS
theme={{
/** Put your mantine theme override here */
colorScheme: 'light',
}}
>
<Component {...pageProps} />
</MantineProvider>
</>
);
}
8 changes: 8 additions & 0 deletions examples/with-mantine/pages/_document.js
@@ -0,0 +1,8 @@
import Document from 'next/document';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a _document.tsx file

import { createGetInitialProps } from '@mantine/next';

const getInitialProps = createGetInitialProps();

export default class MyDocument extends Document {
static getInitialProps = getInitialProps;
}
22 changes: 22 additions & 0 deletions examples/with-mantine/pages/index.js
@@ -0,0 +1,22 @@
import { Title, Text, Anchor } from '@mantine/core';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a index.tsx file


export default function HomePage() {
return (
<>
<Title sx={{ fontSize: 100, fontWeight: 900, letterSpacing: -2 }} align="center" mt={100}>
Welcome to{' '}
<Text inherit variant="gradient" component="span">
Mantine
</Text>
</Title>
<Text color="dimmed" align="center" size="lg" sx={{ maxWidth: 580 }} mx="auto" mt="xl">
This starter Next.js projects includes a minimal setup for server side rendering, if you
want to learn more on Mantine + Next.js integration follow{' '}
<Anchor href="https://mantine.dev/theming/next/" size="lg">
this guide
</Anchor>
. To get started edit index.tsx file.
</Text>
</>
);
}