-
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.
- Loading branch information
Showing
15 changed files
with
397 additions
and
61 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 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 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 |
---|---|---|
@@ -1,60 +1,36 @@ | ||
import { loremIpsum } from 'lorem-ipsum'; | ||
import { CanvasBar, useBodyCanvasBar, CanvasBarConfigContext } from 'canvasbar-react'; | ||
import { | ||
Route, | ||
Routes, | ||
} from 'react-router-dom'; | ||
import { useBodyCanvasBar } from 'canvasbar-react'; | ||
|
||
import './App.css'; | ||
import { Nav } from './Nav'; | ||
import { Basic } from './examples/Basic'; | ||
import { Heavy } from './examples/Heavy'; | ||
import { Customization } from './examples/Customization'; | ||
import { BodyScrollbars } from './examples/BodyScrollbars'; | ||
import { Table } from './examples/Table'; | ||
import { Sticky } from './examples/Sticky'; | ||
|
||
const TEXT = loremIpsum({ count: 100 }); | ||
const TEXT_SMALL = loremIpsum({ count: 7 }); | ||
const IMAGES_IDS = Array.from(Array(10).keys()); | ||
import './App.css'; | ||
|
||
function App() { | ||
export default function App() { | ||
useBodyCanvasBar(); | ||
|
||
return ( | ||
<div className="app"> | ||
<CanvasBar className="my-scrollable-container"> | ||
<div style={{ width: 600 }}> | ||
<h3>Container with both scrollbars</h3> | ||
<p>{TEXT}</p> | ||
</div> | ||
</CanvasBar> | ||
<CanvasBar className="my-scrollable-container"> | ||
<h3>Container with 10 large images (3000x3000 resized to 600x600) and both scrollbars</h3> | ||
{IMAGES_IDS.map(id => ( | ||
<img key={id} src={`https://picsum.photos/id/${id}/3000/3000`} alt="test" /> | ||
))} | ||
</CanvasBar> | ||
<CanvasBar className="my-scrollable-container"> | ||
<h3>Container with vertical scrollbar only</h3> | ||
<p>{TEXT}</p> | ||
</CanvasBar> | ||
<CanvasBar className="my-scrollable-container"> | ||
<div style={{ width: 600 }}> | ||
<h3>Container with horizontal scrollbar only</h3> | ||
<p>{TEXT_SMALL}</p> | ||
</div> | ||
</CanvasBar> | ||
<CanvasBar className="my-scrollable-container" config={{ thumbColor: 'rgba(166, 56, 220, .8)' }}> | ||
<div style={{ width: 600 }}> | ||
<h3>Container with customized scrollbars via config props</h3> | ||
<p>{TEXT}</p> | ||
</div> | ||
</CanvasBar> | ||
<CanvasBarConfigContext.Provider value={{ thumbColor: 'rgba(47, 226, 158, .8)' }}> | ||
<CanvasBar className="my-scrollable-container"> | ||
<div style={{ width: 600 }}> | ||
<h3>Container with customized scrollbars via context</h3> | ||
<b>It's better to use it for customization all (or multiple) scrollbars on the page.</b> | ||
<p>{TEXT}</p> | ||
</div> | ||
</CanvasBar> | ||
</CanvasBarConfigContext.Provider> | ||
<CanvasBar className="my-scrollable-container"> | ||
<h3>Container without scrollbar</h3> | ||
<p>{TEXT_SMALL}</p> | ||
</CanvasBar> | ||
<div> | ||
<Nav /> | ||
<main> | ||
<Routes> | ||
<Route path="/" element={<Basic />} /> | ||
<Route path="/heavy" element={<Heavy />} /> | ||
<Route path="/customization" element={<Customization />} /> | ||
<Route path="/body-scrollbars" element={<BodyScrollbars />} /> | ||
<Route path="/table" element={<Table />} /> | ||
<Route path="/sticky" element={<Sticky />} /> | ||
<Route path="*" element={<Basic />} /> | ||
</Routes> | ||
</main> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
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 @@ | ||
.nav-menu { | ||
display: flex; | ||
flex-wrap: wrap; | ||
list-style: none; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
.nav-link, | ||
.nav-link-active { | ||
display: block; | ||
margin: 12px; | ||
white-space: nowrap; | ||
text-decoration: none; | ||
} | ||
|
||
.nav-link-active { | ||
font-weight: bold; | ||
text-decoration: underline; | ||
} |
Oops, something went wrong.