Skip to content

Commit

Permalink
[breaking] Don't import styles by default
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Mar 1, 2023
1 parent 7f29117 commit abd2072
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ function MyApp() {

### Custom styling

If you don't want to use default React-DateTime-Picker, React-Calendar, and React-Clock styles, you can import React-DateTime-Picker without them by using `import DateTimePicker from 'react-datetime-picker/dist/entry.nostyle';` instead.
If you want to use default React-DateTime-Picker, React-Calendar and React-Clock styling to build upon it, you can import them by using:

Styles loaded by the default entry file are `react-datetime-picker/dist/DateTimePicker.css`, `react-calendar/dist/Calendar.css`, and `react-clock/dist/Clock.css`. You can copy them to your project to build your own upon them.
```js
import 'react-datetime-picker/dist/DateTimePicker.css';
import 'react-calendar/dist/Calendar.css';
import 'react-clock/dist/Clock.css';
```

### Next.js and Vite

Expand Down
2 changes: 1 addition & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"collectCoverageFrom": ["**/src/**.{js,jsx}", "!**/src/entry.js", "!**/src/entry.nostyle.js"],
"collectCoverageFrom": ["**/src/**.{js,jsx}", "!**/src/index.js"],
"reporters": ["default", "github-actions"],
"setupFilesAfterEnv": ["@testing-library/jest-dom"],
"testEnvironment": "jsdom"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "react-datetime-picker",
"version": "4.2.0",
"description": "A date range picker for your React app.",
"main": "dist/entry.js",
"source": "src/entry.js",
"main": "dist/index.js",
"source": "src/index.js",
"scripts": {
"build": "yarn build-js && yarn copy-styles",
"build-js": "babel src -d dist --ignore \"**/*.spec.js,**/*.spec.jsx\"",
Expand Down
12 changes: 0 additions & 12 deletions src/entry.js

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion test/Test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef, useState } from 'react';
import DateTimePicker from 'react-datetime-picker/src/entry.nostyle';
import DateTimePicker from 'react-datetime-picker/src';
import 'react-datetime-picker/src/DateTimePicker.css';
import 'react-calendar/dist/Calendar.css';
import 'react-clock/dist/Clock.css';
Expand Down

0 comments on commit abd2072

Please sign in to comment.