forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(examples): updated
react-multi-carousel
to TS (vercel#37930)
### Example - Moved to typescript - Making use of the Image API (old example only use image tag) ### Dependencies - updated deps to latest - removed unused deps, just to focus on the current example and not other ones ``` @material-ui/core, @material-ui/icons, jss, mobile-detect, react-jss ``` ### Deploy [Example deploy](https://rmcexample-86mr9qpaa-falsepopsky.vercel.app/) ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples) Co-authored-by: Balázs Orbán <[email protected]>
- Loading branch information
Showing
15 changed files
with
100 additions
and
209 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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 Carousel from 'react-multi-carousel' | ||
import { ResponsiveType } from 'react-multi-carousel/lib/types' | ||
import 'react-multi-carousel/lib/styles.css' | ||
import Image from 'next/image' | ||
|
||
const BreakpointSlides: ResponsiveType = { | ||
desktop: { | ||
breakpoint: { max: 3000, min: 1024 }, | ||
items: 3, | ||
}, | ||
tablet: { | ||
breakpoint: { max: 1024, min: 530 }, | ||
items: 2, | ||
}, | ||
mobile: { | ||
breakpoint: { max: 530, min: 0 }, | ||
items: 1, | ||
}, | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<Carousel | ||
responsive={BreakpointSlides} | ||
ssr | ||
infinite | ||
itemClass="carousel-item" | ||
autoPlay | ||
> | ||
<Image | ||
alt="Gundam" | ||
src="/brucetang.jpg" | ||
priority | ||
layout="responsive" | ||
width={700} | ||
height={475} | ||
/> | ||
<Image | ||
alt="Musgo" | ||
src="/cameronsmith.jpg" | ||
priority | ||
layout="responsive" | ||
width={700} | ||
height={475} | ||
/> | ||
<Image | ||
alt="Valley" | ||
src="/ganapathykumar.jpg" | ||
priority | ||
layout="responsive" | ||
width={700} | ||
height={475} | ||
/> | ||
<Image | ||
alt="Beach" | ||
src="/roanlavery.jpg" | ||
layout="responsive" | ||
width={700} | ||
height={475} | ||
/> | ||
<Image | ||
alt="Torii" | ||
src="/tianshuliu.jpg" | ||
layout="responsive" | ||
width={700} | ||
height={475} | ||
/> | ||
</Carousel> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,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"] | ||
} |