diff --git a/CHANGELOG.md b/CHANGELOG.md index 79d3ff3..2c7fd29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The date format used is DD/MM/YYYY. +## [1.0.3] - 04/04/2021 +### Fixed +* Removing overriding styles from body + +## [1.0.2] - 29/03/2021 ## [1.0.1] - 29/03/2021 ### Fixed * Accessibility: Close with keyboard (Esc), and showing button outlines. diff --git a/README.md b/README.md index 456afca..4a0be11 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # @denkschuldt/react-dialog -> A dialog implementation for react. +> A simple to use and customizable react dialog implementation. ## Installation ```bash @@ -14,10 +14,8 @@ $ npm install --save @denkschuldt/react-dialog ## Basic usage -See full DEMO at [@DenkSchuldt/react-dialog](https://dennyschuldt.com/react-dialog) - Preview ```javascript @@ -37,10 +35,12 @@ const App = () => { { isVisible && {}} + onConfirmClick={() => {}} onCloseClick={() => setIsVisible(false)}> - This is the dialog body. + This is the body } @@ -48,11 +48,12 @@ const App = () => { ); } -ReactDOM.render(, document.body); +ReactDOM.render(, document.getElementById('root')); ``` +See more examples at [@DenkSchuldt/react-dialog](https://denkschuldt.github.io/react-dialog) -## Properties +## Props | Name | Type | Required | Description | Default | |-------------------|----------|--------------------|-------------------------------------------------------|---------| @@ -74,6 +75,30 @@ ReactDOM.render(, document.body); | confirmDisabled | Boolean | | Positive button disabled prop | false | +## Styling +Use the className prop to override dialogs classes: +```scss +.your-css-class { + .dnk-dialog-content { + /* The dialog card */ + .dnk-dialog-close { + /* The close button */ + } + .dnk-dialog-body { + .dnk-dialog-body-buttons { + /* The buttons div container */ + button { + /* cancel button */ + &.dnk-btn-primary { + /* confirm button */ + } + } + } + } + } +} +``` + ## Contributing * Fork the project * Make changes and include tests diff --git a/@DenkSchuldt react-dialog.gif b/demo.gif similarity index 59% rename from @DenkSchuldt react-dialog.gif rename to demo.gif index 8552201..14874ee 100644 Binary files a/@DenkSchuldt react-dialog.gif and b/demo.gif differ diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000..3e5566b --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,24 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +yarn.lock +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..02aac3f --- /dev/null +++ b/examples/README.md @@ -0,0 +1,70 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `yarn start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.\ +You will also see any lint errors in the console. + +### `yarn test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `yarn build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) + +### Analyzing the Bundle Size + +This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) + +### Making a Progressive Web App + +This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) + +### Advanced Configuration + +This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) + +### Deployment + +This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) + +### `yarn build` fails to minify + +This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) diff --git a/examples/package.json b/examples/package.json new file mode 100644 index 0000000..9f4ee7b --- /dev/null +++ b/examples/package.json @@ -0,0 +1,56 @@ +{ + "name": "Examples", + "version": "1.0.0", + "private": false, + "repository": { + "type": "git", + "url": "git+https://github.com/DenkSchuldt/react-dialog.git" + }, + "authors": [ + "Denny K. Schuldt (https://github.com/DenkSchuldt)" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/DenkSchuldt/react-dialog/issues" + }, + "homepage": "https://denkschuldt.github.io/react-dialog", + "dependencies": { + "@testing-library/jest-dom": "^5.11.4", + "@testing-library/react": "^11.1.0", + "@testing-library/user-event": "^12.1.10", + "react": "^17.0.2", + "react-code-blocks": "0.0.8", + "react-dom": "^17.0.2", + "react-scripts": "4.0.3", + "web-vitals": "^1.0.1" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject", + "predeploy": "npm run build", + "deploy": "gh-pages -d build" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "devDependencies": { + "gh-pages": "^3.1.0" + } +} diff --git a/examples/src/App.js b/examples/src/App.js new file mode 100644 index 0000000..4ad1b0a --- /dev/null +++ b/examples/src/App.js @@ -0,0 +1,490 @@ + +import { useState } from 'react'; +import Dialog from '@denkschuldt/react-dialog'; +import { CodeBlock, github } from "react-code-blocks"; + +import GithubCorner from './GithubCorner'; + +import './App.scss'; + + +function App() { + const [ customDialog, setCustomDialog ] = useState(); + const [ isDialogVisible, setIsDialogVisible ] = useState(true); + const [ example1, toggleExample1 ] = useState(true); + const [ example2, toggleExample2 ] = useState(true); + const [ example3, toggleExample3 ] = useState(true); + return ( +
+
+
+

@denkschuldt/react-dialog

+

+ A simple to use and customizable react dialog implementation. +

+ +
+ { + isDialogVisible && + setIsDialogVisible(false)} + onCloseClick={() => setIsDialogVisible(false)}> +
+ A simple to use and customizable react dialog implementation. +
+
+ } +
+
+
+

Installation

+ +
+ $ npm i @denkschuldt/react-dialog --save +
+ { + navigator?.clipboard?.writeText('npm i @denkschuldt/react-dialog --save'); + const elem = document.getElementById('dnk-npm'); + const icon = document.getElementById('dnk-npm-icon'); + elem.classList.add('dnk-animate'); + icon.classList.add('dnk-animate'); + elem.addEventListener('animationend', () => { + elem.classList.remove('dnk-animate'); + icon.classList.remove('dnk-animate'); + }); + }}> + +
+
+
+

Usage

+

+ Basic + { + example1 ? + toggleExample1(false)}> + : + toggleExample1(true)}> + + } +

+ { + example1 && + <> + { + const [ isVisible, setIsVisible ] = useState(false); + return ( +
+ + { + isVisible && + setIsVisible(false)}> + + This is the body. + + + } +
+ ); + } + + ReactDOM.render(, document.getElementById('root')); + `} + language={'javascript'} + showLineNumbers={false} + theme={github}/> +
+ +
+ + } +
+
+

+ With buttons + { + example2 ? + toggleExample2(false)}> + : + toggleExample2(true)}> + + } +

+ { + example2 && + <> + { + const [ isVisible, setIsVisible ] = useState(false); + return ( +
+ + { + isVisible && + setIsVisible(false)} + onConfirmClick={() => setIsVisible(false)} + onCloseClick={() => setIsVisible(false)}> + + This is the body. Now the dialog includes two buttons, + one for cancelations, and one for confirmations. + + + } +
+ ); + } + + ReactDOM.render(, document.getElementById('root')); + `} + language={'javascript'} + showLineNumbers={false} + theme={github}/> +
+ +
+ + } +
+
+

+ Overriding styles + { + example3 ? + toggleExample3(false)}> + : + toggleExample3(true)}> + + } +

+ { + example3 && + <> + { + const [ isVisible, setIsVisible ] = useState(false); + return ( +
+ + { + isVisible && + setIsVisible(false)} + onConfirmClick={() => {...}} + onCloseClick={() => setIsVisible(false)}> + + You can change the styles by overriding the dialog's classes + + + } +
+ ); + } + + ReactDOM.render(, document.getElementById('root')); + + /* + styles.scss + .my-custom-styles { + .dnk-dialog-content { + border-radius: 0; + background-color: #fff; + .dnk-dialog-close { + top: 0; + right: 0; + border-radius: 0; + box-shadow: none; + background-color: transparent; + &:hover { + box-shadow: none; + } + } + .dnk-dialog-body { + .dnk-dialog-body-buttons { + justify-content: center; + button { + width: 100%; + border-radius: 0; + } + } + } + } + } + */ + `} + language={'javascript'} + showLineNumbers={false} + theme={github}/> +
+ +
+ + } + + Visit the playground for more examples + + +
+
+

Props

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeRequiredDescriptionDefault
widthNumberDialog width
heightNumberDialog height
titleStringDialog title
draggableBooleanAllows dialog dragtrue
classNameStringComponent class to override styles
slideInStringInitial animation: top, bottom, left, right
cancelableOutsideBooleanWhether the dialogs closes by clicking outside or notfalse
closeOnEscPressBooleanWhether the dialogs closes by pressing escapefalse
hideCloseButtonBooleanHides the close buttonfalse
onCloseClickfunction +

+
Close button click function
cancelTextStringNegative button text'CANCEL'
onCancelClickfunctionNegative button click function
cancelDisabledBooleanNegative button disabled propfalse
confirmTextStringPositive button text'OK'
onConfirmClickfunctionPositive button click function
confirmDisabledBooleanPositive button disabled propfalse
+
+
+
+

License

+

MIT

+
+
+ + { + customDialog && + + + { + customDialog.body || + 'This is the body.' + } + + + } + +
+ ); +} + +export default App; diff --git a/examples/src/App.scss b/examples/src/App.scss new file mode 100644 index 0000000..e1990ac --- /dev/null +++ b/examples/src/App.scss @@ -0,0 +1,269 @@ + +@keyframes pulse { + 0% { + transform: scale(0.95); + box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7); + } + 70% { + transform: scale(1); + box-shadow: 0 0 0 10px rgba(0, 0, 0, 0); + } + 100% { + transform: scale(0.95); + box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); + } +} + +@keyframes blink { + 0% { opacity: 1; } + 50% { opacity: 0; } + 100% { opacity: 1; } +} + +.dnk-animate { + animation: blink 0.5s linear; +} + +.app { + width: 100%; + height: 100%; + overflow: auto; + background: rgb(229,115,115); + background: linear-gradient(45deg, rgba(229,115,115,1) 0%, rgba(130,233,222,1) 100%); + + h1 { + color: #fff; + margin: 16px 0; + font-size: 32px; + } + h2 { + color: #fafafa; + font-size: 24px; + display: flex; + align-items: center; + justify-content: space-between; + i { + cursor: pointer; + } + } + + .app-button { + width: auto; + border: none; + display: flex; + outline: none; + color: #ffffff; + cursor: pointer; + font-size: 16px; + user-select: none; + padding: 12px 32px; + height: fit-content; + border-radius: 36px; + align-items: center; + background: #26a69a; + justify-content: center; + text-transform: uppercase; + transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); + &:hover { + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); + } + } + + .app-header { + width: 100%; + height: 50vh; + position: relative; + .app-header-content { + width: 90%; + height: 100%; + margin: auto; + display: flex; + text-align: center; + align-items: center; + flex-direction: column; + justify-content: center; + p { + color: #303030; + } + button { + margin-top: 32px; + } + } + .dnk-my-dialog { + position: absolute; + .dnk-dialog-content { + max-width: 340px; + transform: scale(1); + animation: pulse 1s infinite; + } + } + } + + .app-body { + width: 60%; + margin: auto; + max-width: 720px; + article { + width: 100%; + display: flex; + padding: 20px 0; + flex-direction: column; + .app-installation-code { + width: 100%; + padding: 20px; + display: flex; + color: #303030; + font-size: 16px; + border-radius: 10px; + align-items: center; + box-sizing: border-box; + justify-content: space-between; + background: rgba(255,255,255,0.75) !important; + background-color: rgba(255,255,255,0.75) !important; + transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); + box-shadow: 0 10px 20px rgba(255,255,255,0.19), 0 6px 6px rgba(0,0,0,0.23); + i { + cursor: pointer; + } + } + span { + &:first-of-type { + border-radius: 10px !important; + background-color: rgba(255,255,255,0.75) !important; + span { + background-color: transparent !important; + } + } + code { + margin-left: -50px; + + } + } + footer { + width: 100%; + display: flex; + padding: 24px 0; + justify-content: flex-end; + } + .app-body-table { + overflow: auto; + table { + color: #303030; + border-radius: 10px; + background-color: rgba(255,255,255,0.75) !important; + box-shadow: 0 10px 20px rgba(255,255,255,0.19), 0 6px 6px rgba(0,0,0,0.23); + tr { + border-top: 1px solid #fff; + background-color: rgba(255,255,255,0.75); + th, td { + padding: 8px; + color: #303030; + } + &:nth-child(even) { + background-color: #f6f8fa; + } + } + thead { + border-top-left-radius: 10px; + border-top-right-radius: 10px; + tr { + border-top-left-radius: 10px; + border-top-right-radius: 10px; + th { + &:first-of-type { + border-top-left-radius: 10px; + } + &:last-of-type { + border-top-right-radius: 10px; + } + } + } + } + tbody { + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; + tr { + &:last-of-type { + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; + td { + &:first-of-type { + border-bottom-left-radius: 10px; + } + &:last-of-type { + border-bottom-right-radius: 10px; + } + } + } + } + } + } + } + .dnk-playground-link { + color: #fff; + display: flex; + cursor: pointer; + margin-top: 40px; + font-weight: bold; + align-items: center; + text-decoration: none; + justify-content: center; + i { + margin-left: 8px; + } + &:hover { + text-decoration: underline; + } + } + } + } + + .app-footer { + color: #fff; + padding: 40px 0 80px 0; + text-align: center; + a { + color: #fff; + font-weight: bold; + text-decoration: none; + } + } + + .my-custom-styles { + .dnk-dialog-content { + border-radius: 0; + background-color: #fff; + .dnk-dialog-close { + top: 0; + right: 0; + border-radius: 0; + box-shadow: none; + background-color: transparent; + &:hover { + box-shadow: none; + } + } + .dnk-dialog-body { + .dnk-dialog-body-buttons { + justify-content: center; + button { + width: 100%; + border-radius: 0; + &.dnk-btn-primary { + background-color: #4b830d; + } + } + } + } + } + } +} + +@media (max-width: 500px) { + .app { + .app-body { + width: 80%; + } + } +} diff --git a/examples/src/App.test.js b/examples/src/App.test.js new file mode 100644 index 0000000..1f03afe --- /dev/null +++ b/examples/src/App.test.js @@ -0,0 +1,8 @@ +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/examples/src/GithubCorner.js b/examples/src/GithubCorner.js new file mode 100644 index 0000000..31679b4 --- /dev/null +++ b/examples/src/GithubCorner.js @@ -0,0 +1,45 @@ + +import './GithubCorner.scss'; + + +const Corner = () => { + return ( + + + + ) +} + +export default Corner; diff --git a/examples/src/GithubCorner.scss b/examples/src/GithubCorner.scss new file mode 100644 index 0000000..9dc470a --- /dev/null +++ b/examples/src/GithubCorner.scss @@ -0,0 +1,35 @@ + +.github-corner { + &:hover { + .octo-arm { + animation: octocat-wave 560ms + ease-in-out + } + } +} + +@keyframes octocat-wave { + 0%, 100% { + transform: rotate(0) + } + 20%, 60% { + transform: rotate(-25deg) + } + 40%, 80% { + transform: rotate(10deg) + } +} +@media (max-width: 500px) { + .github-corner { + &:hover { + .octo-arm { + animation: none + } + .github-corner { + .octo-arm { + animation: octocat-wave 560ms ease-in-out + } + } + } + } +} diff --git a/examples/src/index.js b/examples/src/index.js new file mode 100644 index 0000000..aa79a95 --- /dev/null +++ b/examples/src/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.scss'; +import App from './App'; +import reportWebVitals from './reportWebVitals'; + +ReactDOM.render( + + + , + document.getElementById('root') +); + +// If you want to start measuring performance in your app, pass a function +// to log results (for example: reportWebVitals(console.log)) +// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals +reportWebVitals(); diff --git a/examples/src/index.scss b/examples/src/index.scss new file mode 100644 index 0000000..1ba9b75 --- /dev/null +++ b/examples/src/index.scss @@ -0,0 +1,19 @@ + +html { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + body, + #root { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } +} diff --git a/examples/src/logo.svg b/examples/src/logo.svg new file mode 100644 index 0000000..9dfc1c0 --- /dev/null +++ b/examples/src/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/src/reportWebVitals.js b/examples/src/reportWebVitals.js new file mode 100644 index 0000000..5253d3a --- /dev/null +++ b/examples/src/reportWebVitals.js @@ -0,0 +1,13 @@ +const reportWebVitals = onPerfEntry => { + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); + } +}; + +export default reportWebVitals; diff --git a/examples/src/setupTests.js b/examples/src/setupTests.js new file mode 100644 index 0000000..8f2609b --- /dev/null +++ b/examples/src/setupTests.js @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom'; diff --git a/package.json b/package.json index 644f370..6b04922 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "@denkschuldt/react-dialog", - "version": "1.0.2", + "version": "1.0.3", "private": false, - "description": "A dialog implementation for React.", + "description": "A simple to use and customizable react dialog implementation.", "main": "dist/index.js", "files": [ "dist" @@ -27,7 +27,7 @@ "bugs": { "url": "https://github.com/DenkSchuldt/react-dialog/issues" }, - "homepage": "https://github.com/DenkSchuldt/react-dialog", + "homepage": "https://denkschuldt.github.io/react-dialog", "babel": { "presets": [ "@babel/preset-react", @@ -54,11 +54,7 @@ "start": "rollup -c -w", "build": "rollup -c", "storybook": "start-storybook -p 6006", - "build-storybook": "build-storybook", - "deploy-storybook": "storybook-to-ghpages" - }, - "eslintConfig": { - "extends": "react-app" + "build-storybook": "build-storybook" }, "browserslist": { "production": [ @@ -81,22 +77,25 @@ "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "@rollup/plugin-url": "^6.0.0", - "@storybook/addon-actions": "^6.1.21", - "@storybook/addon-essentials": "^6.1.21", - "@storybook/addon-links": "^6.1.21", - "@storybook/node-logger": "^6.1.21", - "@storybook/preset-create-react-app": "^3.1.7", - "@storybook/react": "^6.1.21", - "@storybook/storybook-deployer": "^2.8.7", + "@storybook/addon-actions": "^6.2.2", + "@storybook/addon-essentials": "^6.2.2", + "@storybook/addon-links": "^6.2.2", + "@storybook/preset-scss": "^1.0.3", + "@storybook/react": "^6.2.2", "@testing-library/react": "^11.2.5", "babel-core": "^6.26.3", "babel-jest": "^26.6.3", + "babel-loader": "^7.1.5", "babel-runtime": "^6.26.0", + "css-loader": "^5.2.0", "jest": "^26.6.0", "node-sass": "4.14.1", "react": "17.0.1", "react-dom": "17.0.1", "rollup": "^2.43.1", - "rollup-plugin-sass": "^1.2.2" + "rollup-plugin-sass": "^1.2.2", + "sass": "^1.32.8", + "sass-loader": "^10.1.1", + "style-loader": "^2.0.0" } } diff --git a/src/components/Button.js b/src/components/Button.js index dd8d3c2..5fe4071 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -11,6 +11,7 @@ const Button = ({ primary, onClick, text, disabled }) => { type='button' onClick={onClick} disabled={disabled} + style={{ cursor: disabled ? 'none' : 'pointer' }} className={`dnk-btn ${primary ? 'dnk-btn-primary' : ''}`}> { text } diff --git a/src/components/Button.scss b/src/components/Button.scss index 53daecc..af31c4f 100644 --- a/src/components/Button.scss +++ b/src/components/Button.scss @@ -16,6 +16,7 @@ transition: all 0.3s cubic-bezier(.25,.8,.25,1); &:hover { opacity: 0.8; + cursor: pointer; } &:disabled { color: #ccc; @@ -23,6 +24,7 @@ } &:active { opacity: 0.6; + cursor: pointer; } &.dnk-btn-primary { color: #fff; @@ -30,6 +32,7 @@ box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); &:hover { opacity: 1; + cursor: pointer; box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); } &:disabled { @@ -46,6 +49,7 @@ } &:active { opacity: 0.8; + cursor: pointer; border: 1px solid #00000029; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } diff --git a/src/components/Dialog.js b/src/components/Dialog.js index c132f64..b8dbc77 100644 --- a/src/components/Dialog.js +++ b/src/components/Dialog.js @@ -88,6 +88,7 @@ const Dialog = (props) => {