Add styles for storybook
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import './styles.css'
|
||||
|
||||
export const parameters = {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
|
||||
47
.storybook/styles.css
Normal file
47
.storybook/styles.css
Normal file
@@ -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;
|
||||
}
|
||||
@@ -17,13 +17,24 @@
|
||||
|
||||
let carousel;
|
||||
|
||||
// goTo
|
||||
let pageIndex
|
||||
function handlePageChange(e) {
|
||||
pageIndex = e.target.value
|
||||
pageIndex = Number(e.target.value)
|
||||
}
|
||||
function handlePageChangeClick() {
|
||||
function handleGoToClick() {
|
||||
carousel.goTo(pageIndex)
|
||||
}
|
||||
|
||||
// goToPrev
|
||||
function handleGoToPrevClick() {
|
||||
carousel.goToPrev()
|
||||
}
|
||||
|
||||
// goToNext
|
||||
function handleGoToNextClick() {
|
||||
carousel.goToNext()
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="main-container">
|
||||
@@ -39,8 +50,21 @@
|
||||
</div>
|
||||
{/each}
|
||||
</Carousel>
|
||||
<input type="number" on:change={handlePageChange} />
|
||||
<button class="button" on:click={handlePageChangeClick}>Go to</button>
|
||||
|
||||
<div class="sb-container">
|
||||
<span class="sb-title">carousel.goTo</span>
|
||||
<input class="sb-input" type="number" on:change={handlePageChange} />
|
||||
<button class="sb-button" on:click={handleGoToClick}>Go</button>
|
||||
<div class="sb-divider"></div>
|
||||
|
||||
<span class="sb-title">carousel.goToPrev</span>
|
||||
<button class="sb-button" on:click={handleGoToPrevClick}>Go</button>
|
||||
<div class="sb-divider"></div>
|
||||
|
||||
<span class="sb-title">carousel.goToNext</span>
|
||||
<button class="sb-button" on:click={handleGoToNextClick}>Go</button>
|
||||
<div class="sb-divider"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@@ -61,13 +85,4 @@
|
||||
font-style: italic;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
}
|
||||
.button {
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user