Created
April 6, 2022 20:18
-
-
Save dinizgb/e997ae2a6747a3e3ee51baa2d5fa870e to your computer and use it in GitHub Desktop.
React Indiana Drag Scroll Default Usage
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
import React, { Component } from 'react'; | |
import styled from 'styled-components'; | |
import ScrollContainer from 'react-indiana-drag-scroll'; | |
const MenuSticky = styled.div` | |
width: 100%; | |
padding: 10px 0; | |
display: -moz-box; | |
display: -webkit-box; | |
top: 0; | |
`; | |
export default function Index() { | |
return ( | |
<> | |
<ScrollContainer component={MenuSticky}> //If you are not using Styled Components you can replace the 'component' with 'className="YOUR_CSS_CLASS"' | |
<div>1</div> | |
<div>2</div> | |
<div>3</div> | |
<div>4</div> | |
</ScrollContainer> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment