Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit 7a82e96

Browse files
committed
Remove webpack configs, work only with styleguidist
1 parent 8d0fec3 commit 7a82e96

File tree

11 files changed

+595
-273
lines changed

11 files changed

+595
-273
lines changed

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
"description": "A React component for choosing dates and date ranges.",
55
"main": "dist/index.js",
66
"scripts": {
7-
"styleguide": "styleguidist server",
8-
"styleguide:build": "styleguidist build",
9-
"dev": "NODE_ENV=development & webpack-dev-server --config webpack/webpack.config.dev.js",
10-
"build": "NODE_ENV=production & yarn build-library & yarn build-demo",
11-
"build-demo": "webpack --config webpack/webpack.config.prod.js",
12-
"build-library": "babel ./src --out-dir ./dist & postcss 'src/styles.scss' -d dist --ext css & postcss 'src/theme/*.scss' -d 'dist/theme' --ext css",
7+
"start": "yarn build:css & yarn build:js & styleguidist server",
8+
"build": "yarn build:css & yarn build:js & styleguidist build",
9+
"build:css": "postcss 'src/styles.scss' -d dist --ext css & postcss 'src/theme/*.scss' -d 'dist/theme' --ext css",
10+
"build:js": "babel ./src --out-dir ./dist",
1311
"lint": "eslint 'src/**/*.js'",
1412
"test": "jest",
1513
"preversion": "yarn clear & yarn build"
@@ -44,7 +42,8 @@
4442
"prop-types": "^15.7.2",
4543
"react": "^16.12.0",
4644
"react-dom": "^16.12.0",
47-
"react-list": "^0.8.13"
45+
"react-list": "^0.8.13",
46+
"url-loader": "^3.0.0"
4847
},
4948
"peerDependencies": {
5049
"react": "^0.14 || ^15.0.0-rc || >=15.0"
@@ -76,7 +75,9 @@
7675
"node-sass": "^4.13.0",
7776
"postcss": "^7.0.25",
7877
"postcss-cli": "^6.1.3",
78+
"postcss-import": "^12.0.1",
7979
"postcss-loader": "^3.0.0",
80+
"precss": "^4.0.0",
8081
"prettier": "^1.19.1",
8182
"react-styleguidist": "^10.4.0",
8283
"sass-loader": "^8.0.0",

postcss.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
const precss = require('precss');
12
const autoprefixer = require('autoprefixer');
3+
const cssImport = require('postcss-import');
24

35
module.exports = {
4-
plugins: [autoprefixer()],
6+
plugins: [cssImport(), precss(), autoprefixer()],
57
};

src/components/Calendar/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
DatePicker - Internationalization
1+
### Internationalization
22

33
```jsx inside Markdown
4-
import Calendar from 'react-date-range/components/Calendar';
5-
import * as locales from 'react-date-range/locale';
6-
//import '../../dist/styles.css'; // main style file
7-
//import 'react-date-range/dist/theme/default.css'; // theme css file
4+
import { Calendar } from 'react-date-range';
5+
import * as locales from 'react-date-range/dist/locale';
6+
import 'react-date-range/dist/styles.css'; // main style file
7+
import 'react-date-range/dist/theme/default.css'; // theme css file
88

99
const [locale, setLocale] = React.useState('ja');
1010
<Calendar

src/components/DateRange/DateRange.js

Lines changed: 0 additions & 151 deletions
This file was deleted.

src/styles.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@import 'components/Calendar';
2-
@import 'components/DateRange';
3-
@import 'components/DateInput';
4-
@import 'components/DayCell';
5-
@import 'components/DateRangePicker';
6-
@import 'components/DefinedRange';
1+
@import 'components/Calendar/index.scss';
2+
@import 'components/DateRange/index.scss';
3+
@import 'components/DateInput/index.scss';
4+
@import 'components/DayCell/index.scss';
5+
@import 'components/DateRangePicker/index.scss';
6+
@import 'components/DefinedRange/index.scss';

src/theme/default.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.rdrCalendarWrapper{
22
color: #000000;
33
font-size: 12px;
4+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
45
}
56

67
.rdrDateDisplay{

styleguide.config.js

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,94 @@
11
const path = require('path');
22

33
module.exports = {
4-
webpackConfig: require('./webpack/webpack.config.dev.js'),
4+
ignore: ['**/*.test.js', '**/DateInput/*', '**/DayCell/*', '**/Month/*', '**/InputRangeField/*'],
5+
title: 'react-date-range',
6+
showSidebar: false,
7+
template: {
8+
head: {
9+
links: [
10+
{
11+
rel: 'stylesheet',
12+
href: 'https://fonts.googleapis.com/css?family=Open+Sans:300,400',
13+
},
14+
{
15+
rel: 'stylesheet',
16+
href: './dist/styles.css',
17+
},
18+
{
19+
rel: 'stylesheet',
20+
href: './dist/theme/default.css',
21+
},
22+
{
23+
rel: 'stylesheet',
24+
href: './styleguide/styles.css',
25+
},
26+
],
27+
},
28+
},
29+
theme: {
30+
baseBackground: '#fdfdfc',
31+
link: '#274e75',
32+
linkHover: '#90a7bf',
33+
border: '#e0d2de',
34+
font: ['Open Sans'],
35+
fontFamily: {
36+
base: '"Open Sans", "Helvetica", sans-serif',
37+
},
38+
},
39+
40+
getComponentPathLine(componentPath) {
41+
const arr = componentPath.split('/');
42+
const name = arr[arr.length - 2];
43+
return `import { ${name} } from 'react-date-range';`;
44+
},
45+
46+
styles: function styles(theme) {
47+
return {
48+
Playground: {
49+
preview: {
50+
paddingLeft: 0,
51+
paddingRight: 0,
52+
borderWidth: [[0, 0, 1, 0]],
53+
borderRadius: 0,
54+
},
55+
},
56+
Code: {
57+
code: {
58+
// make inline code example appear the same color as links
59+
color: theme.color.link,
60+
fontSize: 14,
61+
},
62+
},
63+
};
64+
},
65+
// Override Styleguidist components
66+
styleguideComponents: {
67+
LogoRenderer: path.join(__dirname, 'styleguide/components/Logo'),
68+
StyleGuideRenderer: path.join(__dirname, 'styleguide/components/StyleGuide'),
69+
SectionsRenderer: path.join(__dirname, 'styleguide/components/SectionsRenderer'),
70+
},
571
moduleAliases: {
6-
'react-date-range': path.resolve(__dirname, 'src'),
72+
'react-date-range/dist': path.resolve(__dirname, 'dist'),
73+
'react-date-range': path.resolve(__dirname, 'dist'),
74+
},
75+
webpackConfig: {
76+
module: {
77+
rules: [
78+
{
79+
test: /\.jsx?$/,
80+
exclude: /node_modules/,
81+
loader: 'babel-loader',
82+
},
83+
{
84+
test: /\.css$/,
85+
loader: 'style-loader!css-loader?modules',
86+
},
87+
{
88+
test: /\.svg$/,
89+
loader: 'url-loader',
90+
},
91+
],
92+
},
793
},
894
};

webpack/webpack.config.common.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)