Unverified Commit 1f0f2c0a authored by Marzouq's avatar Marzouq Committed by GitHub

added with-react-foundation example (#36375)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## 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.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
parent b6f168bd
# 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
# vercel
.vercel
# react-foundation Example
This example shows how to use Next.js with [react-foundation](https://digia.online/react-foundation-docs/) and 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-react-foundation)
[![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-react-foundation&project-name=with-react-foundation&repository-name=with-react-foundation)
## 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-react-foundation with-react-foundation-app
# or
yarn create next-app --example with-react-foundation with-react-foundation-app
# or
pnpm create next-app -- --example with-react-foundation with-react-foundation-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)).
/// <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.
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"foundation-sites": "6.7.4",
"next": "latest",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-foundation": "^0.9.7"
},
"devDependencies": {
"@types/node": "^17.0.25",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.2",
"typescript": "4.6.3"
}
}
// Import react-foundation components
import { Grid, Cell } from 'react-foundation'
// Own custom component
import { Card } from './Card'
export const Article = () => {
return (
<Grid upOnSmall={1} upOnMedium={2} upOnLarge={2}>
<Cell className="cell">
<Card isColumn />
</Cell>
<Cell>
<Card isColumn />
</Cell>
</Grid>
)
}
// Import react-foundation components
import { MediaObject, MediaObjectSection, Thumbnail } from 'react-foundation'
export const Card = () => {
return (
<div className="cardlayout">
<MediaObject>
<MediaObjectSection>
<Thumbnail src="https://source.unsplash.com/random/100x100" />
</MediaObjectSection>
<MediaObjectSection isMain>
<h4>Important Heading Here</h4>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime
mollitia, molestiae quas vel sint commod.
</p>
</MediaObjectSection>
</MediaObject>
</div>
)
}
// Import react-foundation components
import { Menu, MenuItem } from 'react-foundation'
export const Header = () => {
return (
<Menu>
<MenuItem>
<a href="/">Home</a>
</MenuItem>
<MenuItem>
<a href="/">Blog</a>
</MenuItem>
<MenuItem>
<a href="/">About</a>
</MenuItem>
<MenuItem>
<a href="/">Contact</a>
</MenuItem>
</Menu>
)
}
// Add Foundation to index.js
import 'foundation-sites/dist/css/foundation.min.css'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
export default MyApp
import Link from 'next/link'
import { Article } from '../components/Article'
import { Header } from '../components/Header'
import { Callout } from 'react-foundation'
export default function Home() {
return (
<>
<Header />
<Article />
<div className="callout-sizes-example">
<Callout>
<h5>with-react-foundation</h5>
<p>
Example repository of <code>Next.js</code> +{' '}
<code>react-foundation</code>.
</p>
<Link href="https://nextjs.org" passHref={true}>
<a>view repository</a>
</Link>
</Callout>
</div>
</>
)
}
{
"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",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
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