Skip to content

Commit

Permalink
Fix: Doc (#7)
Browse files Browse the repository at this point in the history
* docs: example.gif source updated

* docs: keywords updated

* fix: default prop value

* docs: example updated
  • Loading branch information
tvankith authored Feb 22, 2024
1 parent 6762a2e commit ade0d0c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
55 changes: 47 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scroller with Sticky Header

This React component provides a scroller with a sticky header, allowing users to scroll through content horizontally while keeping the header fixed at the top of the section. See [Codesandbox example](https://codesandbox.io/p/devbox/horizontal-scroll-with-sticky-header-y8mnpg)
This React component provides a scroller with a sticky header, allowing users to scroll through content horizontally while keeping the header fixed at the top of the section. See [Codesandbox example](https://scroller-with-sticky-header-uploads.s3.amazonaws.com/example.gif)

![Example](./assets/example.gif)

Expand All @@ -20,7 +20,7 @@ yarn add scroller-with-sticky-header

## Usage

To use the component, import it into your React application and incorporate it as needed:
To use the component, import it into your React application and incorporate it as needed, Just look one example

```jsx
import { Scroll } from "scroller-with-sticky-header";
Expand All @@ -30,21 +30,35 @@ function App() {
<div className="container">
<Scroll gap="10px">
<Scroll.Group>
<Scroll.Title>Title 1</Scroll.Title>
<Scroll.Title>Utrhoncus</Scroll.Title>
<Scroll.Item>
<div>...</div>
<div className="block1"></div>
</Scroll.Item>
</Scroll.Group>
<Scroll.Group>
<Scroll.Title>Title 2</Scroll.Title>
<Scroll.Title>Nam feugiat</Scroll.Title>
<Scroll.Item>
<div>...</div>
<div className="block2"></div>
</Scroll.Item>
<Scroll.Item>
<div>...</div>
<div className="block2"></div>
</Scroll.Item>
</Scroll.Group>
<Scroll.Group>
<Scroll.Title>Maecenas at purus</Scroll.Title>
<Scroll.Item>
<div className="block3"></div>
</Scroll.Item>
<Scroll.Item>
<div className="block3"></div>
</Scroll.Item>
<Scroll.Item>
<div className="block3"></div>
</Scroll.Item>
<Scroll.Item>
<div className="block3"></div>
</Scroll.Item>
</Scroll.Group>
...
</Scroll>
</div>
);
Expand All @@ -53,6 +67,31 @@ function App() {
export default App;
```

```css
.block1 {
background-color: coral;
width: 200px;
height: 100px;
}

.block2 {
background-color: cornflowerblue;
width: 200px;
height: 100px;
}

.block3 {
background-color: darkcyan;
width: 200px;
height: 100px;
}

.container {
max-width: 300px;
}
```


## Props

The component accepts the following props:
Expand Down
Binary file removed assets/example.gif
Binary file not shown.
4 changes: 4 additions & 0 deletions components/scroller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@ Scroll.Title = Title;

Scroll.Item = Item;

Scroll.defaultProps = {
gap: "10px"
}

export default Scroll;
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
"name": "scroller-with-sticky-header",
"version": "1.0.2",
"description": "Scroller with sticky header",
"keywords": [
"scroller-with-sticky-header",
"sticky-header",
"react",
"scroll",
"scroller"
],
"main": "dist/index.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit ade0d0c

Please sign in to comment.