Unverified Commit 802a7721 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove outdated/deprecated/unmainted examples (#24945)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
parent 9e87596b
{
"presets": ["next/babel"],
"plugins": [
[
"import",
{
"libraryName": "antd",
"style": true
}
]
]
}
# 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
# Ant Design example
This example shows how to use Next.js along with [Ant Design of React](https://ant.design). This is intended to show the integration of this UI toolkit with the Framework.
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
[![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-ant-design-less&project-name=with-ant-design-less&repository-name=with-ant-design-less)
## 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-ant-design-less with-ant-design-app
# or
yarn create next-app --example with-ant-design-less with-ant-design-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)).
@primary-color: #52c41a;
@layout-header-height: 40px;
@border-radius-base: 2px;
/* eslint-disable */
const withLess = require('@zeit/next-less')
const lessToJS = require('less-vars-to-js')
const fs = require('fs')
const path = require('path')
// Where your antd-custom.less file lives
const themeVariables = lessToJS(
fs.readFileSync(path.resolve(__dirname, './assets/antd-custom.less'), 'utf8')
)
module.exports = withLess({
lessLoaderOptions: {
javascriptEnabled: true,
modifyVars: themeVariables, // make your antd custom effective
},
webpack: (config, { isServer }) => {
if (isServer) {
const antStyles = /antd\/.*?\/style.*?/
const origExternals = [...config.externals]
config.externals = [
(context, request, callback) => {
if (request.match(antStyles)) return callback()
if (typeof origExternals[0] === 'function') {
origExternals[0](context, request, callback)
} else {
callback()
}
},
...(typeof origExternals[0] === 'function' ? [] : origExternals),
]
config.module.rules.unshift({
test: antStyles,
use: 'null-loader',
})
}
return config
},
})
{
"name": "with-ant-design-less",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@zeit/next-less": "^1.0.1",
"antd": "^3.5.4",
"babel-plugin-import": "^1.7.0",
"less": "3.0.4",
"less-vars-to-js": "1.3.0",
"next": "latest",
"null-loader": "2.0.0",
"react": "^16.7.0",
"react-dom": "^16.7.0"
},
"license": "MIT"
}
import {
Form,
Select,
InputNumber,
DatePicker,
Switch,
Slider,
Button,
} from 'antd'
const FormItem = Form.Item
const Option = Select.Option
export default function Home() {
return (
<div style={{ marginTop: 100 }}>
<Form layout="horizontal">
<FormItem
label="Input Number"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<InputNumber
size="large"
min={1}
max={10}
style={{ width: 100 }}
defaultValue={3}
name="inputNumber"
/>
<a href="#">Link</a>
</FormItem>
<FormItem
label="Switch"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Switch defaultChecked name="switch" />
</FormItem>
<FormItem
label="Slider"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Slider defaultValue={70} />
</FormItem>
<FormItem
label="Select"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Select
size="large"
defaultValue="lucy"
style={{ width: 192 }}
name="select"
>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>
disabled
</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
</FormItem>
<FormItem
label="DatePicker"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<DatePicker name="startDate" />
</FormItem>
<FormItem style={{ marginTop: 48 }} wrapperCol={{ span: 8, offset: 8 }}>
<Button size="large" type="primary" htmlType="submit">
OK
</Button>
<Button size="large" style={{ marginLeft: 8 }}>
Cancel
</Button>
</FormItem>
</Form>
</div>
)
}
{
"presets": ["next/babel"],
"plugins": [
[
"import",
{
"libraryName": "antd",
"style": true
}
]
]
}
# 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
# Ant Design Pro Layout example
This example shows how to use Next.js along with [Ant Design Pro Layout](https://github.com/ant-design/ant-design-pro-layout) of React. This is intended to show the integration of this UI toolkit with the Framework.
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
[![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-ant-design-pro-layout-less&project-name=with-ant-design-pro-layout-less&repository-name=with-ant-design-pro-layout-less)
## 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-ant-design-pro-layout-less with-ant-design-app
# or
yarn create next-app --example with-ant-design-pro-layout-less with-ant-design-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)).
@primary-color: #52c41a;
@layout-header-height: 40px;
@border-radius-base: 2px;
import dynamic from 'next/dynamic'
import Link from 'next/link'
import {
SmileOutlined,
SettingOutlined,
PlaySquareOutlined,
} from '@ant-design/icons'
import { Route, MenuDataItem } from '@ant-design/pro-layout/lib/typings'
import { SiderMenuProps } from '@ant-design/pro-layout/lib/SiderMenu/SiderMenu'
const ProLayout = dynamic(() => import('@ant-design/pro-layout'), {
ssr: false,
})
const ROUTES: Route = {
path: '/',
routes: [
{
path: '/',
name: 'Welcome',
icon: <SmileOutlined />,
routes: [
{
path: '/welcome',
name: 'Account Settings',
icon: <SettingOutlined />,
},
],
},
{
path: '/example',
name: 'Example Page',
icon: <PlaySquareOutlined />,
},
],
}
const menuHeaderRender = (
logoDom: React.ReactNode,
titleDom: React.ReactNode,
props: SiderMenuProps
) => (
<Link href="/">
<a>
{logoDom}
{!props?.collapsed && titleDom}
</a>
</Link>
)
const menuItemRender = (options: MenuDataItem, element: React.ReactNode) => (
<Link href={options.path}>
<a>{element}</a>
</Link>
)
export default function Main({ children }) {
return (
<ProLayout
style={{ minHeight: '100vh' }}
route={ROUTES}
menuItemRender={menuItemRender}
menuHeaderRender={menuHeaderRender}
>
{children}
</ProLayout>
)
}
/// <reference types="next" />
/// <reference types="next/types/global" />
/* eslint-disable */
const withLess = require('@zeit/next-less')
const lessToJS = require('less-vars-to-js')
const fs = require('fs')
const path = require('path')
// Where your antd-custom.less file lives
const themeVariables = lessToJS(
fs.readFileSync(path.resolve(__dirname, './assets/antd-custom.less'), 'utf8')
)
module.exports = withLess({
lessLoaderOptions: {
javascriptEnabled: true,
modifyVars: themeVariables, // make your antd custom effective
},
webpack: (config, { isServer }) => {
if (isServer) {
const antStyles = /antd\/.*?\/style.*?/
const origExternals = [...config.externals]
config.externals = [
(context, request, callback) => {
if (request.match(antStyles)) return callback()
if (typeof origExternals[0] === 'function') {
origExternals[0](context, request, callback)
} else {
callback()
}
},
...(typeof origExternals[0] === 'function' ? [] : origExternals),
]
config.module.rules.unshift({
test: antStyles,
use: 'null-loader',
})
}
return config
},
})
{
"name": "with-ant-design-pro-layout-less",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@ant-design/icons": "4.1.0",
"@ant-design/pro-layout": "5.0.10",
"@zeit/next-less": "^1.0.1",
"antd": "^4.2.0",
"babel-plugin-import": "^1.13.0",
"esm": "3.2.25",
"less": "3.11.1",
"less-vars-to-js": "1.3.0",
"next": "latest",
"null-loader": "4.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"webpack-filter-warnings-plugin": "1.2.1"
},
"license": "MIT",
"devDependencies": {
"@types/node": "13.13.4",
"@types/react": "^16.9.36",
"typescript": "4.0"
}
}
import MainLayout from '../layouts/main'
export default function Example() {
return <MainLayout>Example page</MainLayout>
}
import {
Form,
Select,
InputNumber,
DatePicker,
Switch,
Slider,
Button,
} from 'antd'
import MainLayout from '../layouts/main'
const FormItem = Form.Item
const Option = Select.Option
export default function Home() {
return (
<MainLayout>
<Form layout="horizontal">
<FormItem
label="Input Number"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<InputNumber
size="large"
min={1}
max={10}
style={{ width: 100 }}
defaultValue={3}
name="inputNumber"
/>
<a href="#">Link</a>
</FormItem>
<FormItem
label="Switch"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Switch defaultChecked />
</FormItem>
<FormItem
label="Slider"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Slider defaultValue={70} />
</FormItem>
<FormItem
label="Select"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<Select size="large" defaultValue="lucy" style={{ width: 192 }}>
<Option value="jack">jack</Option>
<Option value="lucy">lucy</Option>
<Option value="disabled" disabled>
disabled
</Option>
<Option value="yiminghe">yiminghe</Option>
</Select>
</FormItem>
<FormItem
label="DatePicker"
labelCol={{ span: 8 }}
wrapperCol={{ span: 8 }}
>
<DatePicker name="startDate" />
</FormItem>
<FormItem style={{ marginTop: 48 }} wrapperCol={{ span: 8, offset: 8 }}>
<Button size="large" type="primary" htmlType="submit">
OK
</Button>
<Button size="large" style={{ marginLeft: 8 }}>
Cancel
</Button>
</FormItem>
</Form>
</MainLayout>
)
}
import MainLayout from '../layouts/main'
export default function Welcome() {
return <MainLayout>Welcome!</MainLayout>
}
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
# 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
# Example App with next-less
This example demonstrates how to use the [next-less plugin](https://github.com/zeit/next-plugins/tree/master/packages/next-less).
It includes patterns for with and without CSS Modules, with PostCSS and with additional webpack configurations on top of the next-less plugin.
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
[![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-next-less&project-name=with-next-less&repository-name=with-next-less)
## 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-next-less with-next-less-app
# or
yarn create next-app --example with-next-less with-next-less-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)).
const withLess = require('@zeit/next-less')
/* Without CSS Modules, with PostCSS */
module.exports = withLess()
/* With CSS Modules */
// module.exports = withLess({ cssModules: true })
/* With additional configuration on top of CSS Modules */
/*
module.exports = withLess({
cssModules: true,
webpack: function (config) {
return config;
}
});
*/
{
"name": "with-next-less",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@zeit/next-less": "^1.0.1",
"less": "^3.0.4",
"next": "latest",
"react": "^16.7.0",
"react-dom": "^16.7.0"
},
"license": "MIT"
}
/*
In production the stylesheet is compiled to .next/static/style.css and served from /_next/static/style.css
You have to include it into the page using either next/head or a custom _document.js, as is being done in this file.
*/
import Document, { Html, Head, Main, NextScript } from 'next/document'
export default class MyDocument extends Document {
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}
// Without CSS Modules
import '../style.less'
export default function Home() {
return <div className="example">Hello Less!</div>
}
// With CSS Modules
/*
import style from '../style.less'
export default function Home() {
return <div className={style.example}>Hello Less!</div>
}
*/
@theme: red;
.example {
color: @theme;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment