-
Notifications
You must be signed in to change notification settings - Fork 0
/
styleguide.config.js
189 lines (187 loc) · 6.54 KB
/
styleguide.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
title: "Slider component for React - Slidish",
// Folder for static HTML style guide generated with styleguidist build command.
styleguideDir: "docs",
// An object with options to add a favicon, meta tags, inline JavaScript or CSS, etc. See @vxna/mini-html-webpack-template docs.
template: {
favicon: "favicon.ico",
head: {
meta: [
{
name: "description",
content: `React slider/carousel component for building sliders of all type of components, Read this
documentation for full explanation of every feature with examples and playground`,
},
{ name: "author", content: "Abbas Hosseini" },
{
name: "keywords",
content:
"react, slider, carousel, image, gallery, slidish, slideshow, swiper, responsive, mobile-friendly, touch",
},
],
raw: `<style>
code {
background-color: #1b1f230d !important;
border-radius: 6px !important;
font-size: 85% !important;
padding: .2em .4em !important;
}
.next-section {
display: block;
float: right !important;
padding: 10px 15px !important;
text-align: center !important;
border: 2px solid #06d !important;
font-family: sans-serif !important;
}
.next-section::before {
content:"Next: ";
}
.previous-section {
display: block;
float: left !important;
padding: 10px 15px !important;
text-align: center !important;
border: 2px solid #06d !important;
font-family: sans-serif !important;
}
.previous-section::before {
content:"Previous: ";
}
main footer {
margin-top: 100px !important;
}
</style>`,
},
},
// components: "src/components/slider/index.tsx",
// Modules that are required for your style guide. Useful for third-party styles or polyfills.
require: [
// // For making `Slidish` available in every example
path.resolve(__dirname, "src", "styleguide", "setup.js"),
path.resolve(__dirname, "src", "style.scss"),
],
// tocMode: "collapse",
pagePerSection: true,
sections: [
{ name: "Introduction", content: "src/docs/introduction.md" },
{ name: "Features", content: "src/docs/features.md" },
{ name: "Playground", content: "src/docs/playground.md" },
{ name: "Fancy Demo", content: "src/docs/demo.md" },
{
name: "Documentation",
sectionDepth: 3,
href: "#/Documentation/Getting%20Started",
sections: [
{ name: "Getting Started", content: "src/docs/documentation/getting-started.md" },
{ name: "Main Options", content: "src/docs/documentation/main-options.md" },
{ name: "Advanced Options", content: "src/docs/documentation/advanced-options.md" },
{ name: "Slideshow", content: "src/docs/documentation/slideshow.md" },
{ name: "Custom Thumbnails", content: "src/docs/documentation/thumbs.md" },
{ name: "Lazy Loading", content: "src/docs/documentation/lazy-loading.md" },
{ name: "Event Handlers", content: "src/docs/documentation/event-handlers.md" },
{ name: "Methods", content: "src/docs/documentation/methods.md" },
{
name: "User Interface",
href: "#/Documentation/User%20Interface/Layout",
sections: [
{ name: "Layout", content: "src/docs/documentation/ui/layout.md" },
{ name: "ClassNames", content: "src/docs/documentation/ui/classnames.md" },
{ name: "Inline Styles", content: "src/docs/documentation/ui/styles.md" },
],
},
{
name: "Developer Guide",
href: "#/Documentation/Developer%20Guide/Browser%20Support",
sections: [
{ name: "Browser Support", content: "src/docs/documentation/developer-guide/browser-support.md" },
{ name: "TypeScript", content: "src/docs/documentation/developer-guide/typescript.md" },
{ name: "Server Side Rendering", content: "src/docs/documentation/developer-guide/ssr.md" },
{ name: "Testing", content: "src/docs/documentation/developer-guide/testing.md" },
],
},
],
},
],
webpackConfig: {
module: {
rules: [
{
test: /\.(t|j)sx?$/,
use: [
{
loader: "babel-loader",
options: {
presets: [
[
"@babel/preset-env",
{
targets: {
browsers: "last 2 versions",
},
useBuiltIns: "usage",
corejs: "3.15",
},
],
["@babel/preset-typescript", { onlyRemoveTypeImports: true }],
],
babelrc: false,
},
},
{ loader: "ts-loader" },
],
exclude: /node_modules/,
},
{
test: /\.(sa|sc|c)ss$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: {
modules: {
auto: true,
localIdentName: "[name]--[hash:base64:5]",
},
importLoaders: 2,
// 0 => no loaders (default);
// 1 => postcss-loader;
// 2 => postcss-loader, sass-loader
},
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: ["autoprefixer"],
},
},
},
"sass-loader",
],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
],
},
plugins: [
new CopyPlugin({
patterns: [{ from: "public", to: "." }],
}),
],
resolve: {
extensions: [".tsx", ".ts", ".js", ".jsx"],
alias: {
src: path.resolve(__dirname, "src"),
components: path.resolve(__dirname, "src/components/"),
hooks: path.resolve(__dirname, "src/hooks/"),
store: path.resolve(__dirname, "src/store/"),
slidish: path.resolve(__dirname, "src"),
},
},
},
};