Skip to content

Commit

Permalink
Merge pull request #35 from vadimkorr/feature/#33_Change-pages-progra…
Browse files Browse the repository at this point in the history
…mmatically

Feature/#33 Change pages programmatically
  • Loading branch information
vadimkorr authored Jun 30, 2021
2 parents 121ca24 + cdc03da commit b07caa9
Show file tree
Hide file tree
Showing 14 changed files with 483 additions and 37 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ storybook-static
# dist
scripts

.test.js
src/**/*.test.js

DEPLOYMENT.md
1 change: 1 addition & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './styles.css'

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
Expand Down
47 changes: 47 additions & 0 deletions .storybook/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.sb-container {
padding: 10px;
border-radius: 5px;
background-color: #d2d2d2;
}

span.sb-title {
color: #3e3e3e;
display: block;
margin: 5px;
font-size: 16px;
font-family: Arial, Helvetica, sans-serif;
}

.sb-divider {
max-width: 100%;
border-bottom: solid 3px #ffffff;
margin: 5px;
box-sizing: border-box;
}

.sb-button {
width: 150px;
height: 35px;
margin: 5px;
padding: 0px 10px;
border-radius: 5px;
background-color: #009800;
border: none;
color: white;
text-decoration: none;
font-size: 14px;
cursor: pointer;
}

.sb-input[type=text],
.sb-input[type=number] {
width: 150px;
height: 35px;
margin: 5px;
padding: 0px 10px;
border-radius: 5px;
display: inline-block;
border: 1px solid #9f9f9f;
outline: none;
box-sizing: border-box;
}
14 changes: 14 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# How to publish new feature:

1. Update unit tests
2. Update storybook

3. Update version in `package.json`

4. Update docs in `README.md`
5. Update docs in `src/docs`
6. `yarn build:docs`

7. `npm publish`
8. Merge feature branch
9. Create release in GitHub
83 changes: 82 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,85 @@ Slot props:
</div>
<!-- -->
</Carousel>
```
```

## Methods

### `goTo`
Navigates to a page by index

Arguments:

| Argument | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------|
| `pageIndex` | `number` | | Page number |
| `options.animated` | `boolean` | `true` | Should it be animated or not |

```jsx
<script>
// ...
let carousel;
function goToStartPage() {
carousel.goTo(0, { animated: false })
}
</script>

<Carousel
bind:this={carousel}
>
<!-- -->
</Carousel>
<button class="button" on:click={goToStartPage}>Go</button>
```

### `goToPrev`
Navigates to the previous page

Arguments:

| Argument | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------|
| `options.animated` | `boolean` | `true` | Should it be animated or not |

```jsx
<script>
// ...
let carousel;
function goToPrevPage() {
carousel.goToPrev({ animated: false })
}
</script>

<Carousel
bind:this={carousel}
>
<!-- -->
</Carousel>
<button class="button" on:click={goToPrevPage}>Go</button>
```

### `goToNext`
Navigates to the next page

Arguments:

| Argument | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------|
| `options.animated` | `boolean` | `true` | Should it be animated or not |

```jsx
<script>
// ...
let carousel;
function goToNextPage() {
carousel.goToNext({ animated: false })
}
</script>

<Carousel
bind:this={carousel}
>
<!-- -->
</Carousel>
<button class="button" on:click={goToNextPage}>Go</button>
```
2 changes: 1 addition & 1 deletion docs/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b07caa9

Please sign in to comment.