Skip to content

Instantly share code, notes, and snippets.

@gtokman
Created March 15, 2021 15:52
Show Gist options
  • Select an option

  • Save gtokman/18b9d5a0fd70241aea1a2a3af1b7e27f to your computer and use it in GitHub Desktop.

Select an option

Save gtokman/18b9d5a0fd70241aea1a2a3af1b7e27f to your computer and use it in GitHub Desktop.
Scrollable List
import logo from "./logo.svg";
import "./App.css";
import styled from "styled-components";
function App() {
return (
<Container>
<WrapperCard>
<Card></Card>
<Card></Card>
{/* <Card></Card> eventually loop */}
</WrapperCard>
</Container>
);
}
const Container = styled.div`
background: #36393e;
width: 100%;
height: 100%;
position: fixed;
display: flex;
justify-content: center;
flex-direction: row;
`;
const WrapperCard = styled.div`
display: flex;
justify-content: center;
flex-direction: column;
overflow: auto;
height: 100%;
white-space: nowrap;
`;
const Card = styled.div`
margin: 20px;
background: #fff;
height: 400px;
width: 400px;
border-radius: 20px;
`;
export default App;
@gtokman
Copy link
Copy Markdown
Author

gtokman commented Mar 15, 2021

const Container = styled.div`
  background: #36393e;
  width: 100%;
  height: 100%;
  position: fixed;
  display: flex;
  justify-content: center;
  flex-direction: row;
  overflow: hidden; // add
`;

const WrapperCard = styled.div`
  display: flex;
  justify-content: center;
  flex-direction: column;
  flex-wrap: wrap; // add
  overflow: auto;
  height: 100%;
  /* white-space: nowrap; */
`;

const Card = styled.div`
  margin: 20px;
  background: #fff;
  height: 400px;
  width: 400px;
  border-radius: 20px;
  flex: 0 0 400px; // add
`;

2021-03-15 12 23 22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment