diff --git a/.editorconfig b/.editorconfig
index 013c8c5..37fee84 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,6 +8,3 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
-
-[*.css,*.scss]
-indent_size = 4
diff --git a/.stylelintrc b/.stylelintrc
index 38d2566..7f7097c 100644
--- a/.stylelintrc
+++ b/.stylelintrc
@@ -3,10 +3,5 @@
"stylelint-config-standard",
"stylelint-config-css-modules",
"./node_modules/prettier-stylelint/config.js"
- ],
- "rules": {
- "indentation": 4,
- "declaration-empty-line-before": null,
- "number-leading-zero": "never"
- }
+ ]
}
diff --git a/package.json b/package.json
index 1d145c5..7569e34 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,9 @@
"package": "electron-builder build -mwl -p never && open ./dist",
"dist": "rm -rf {dist,build}/ && npm run build && npm run package",
"release": "release-it --non-interactive",
- "changelog": "auto-changelog -p"
+ "changelog": "auto-changelog -p",
+ "format": "prettier --write 'src/**/*.{js,jsx}' && npm run format:css",
+ "format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'"
},
"repository": "https://github.com/kremalicious/blowfish.git",
"homepage": "https://github.com/kremalicious/blowfish",
@@ -38,6 +40,7 @@
"auto-changelog": "^1.16.1",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
+ "classnames": "^2.2.6",
"copy-webpack-plugin": "^5.0.4",
"cross-env": "^5.2.1",
"css-loader": "^3.2.0",
@@ -51,14 +54,12 @@
"file-loader": "^4.2.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.8.0",
- "node-sass": "^4.12.0",
"prettier": "^1.18.2",
"prettier-stylelint": "^0.4.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-pose": "^4.0.8",
"release-it": "^12.3.6",
- "sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"stylelint": "^10.1.0",
"stylelint-config-css-modules": "^1.4.0",
diff --git a/src/main/index.js b/src/main/index.js
index b5bf913..c7d98a1 100644
--- a/src/main/index.js
+++ b/src/main/index.js
@@ -132,22 +132,22 @@ const installDevTools = async mainWindow => {
const createWindowEvents = mainWindow => {
mainWindow.on('enter-full-screen', () =>
mainWindow.webContents.executeJavaScript(
- 'document.getElementsByTagName(\'html\')[0].classList.add(\'fullscreen\')'
+ "document.getElementsByTagName('html')[0].classList.add('fullscreen')"
)
)
mainWindow.on('leave-full-screen', () =>
mainWindow.webContents.executeJavaScript(
- 'document.getElementsByTagName(\'html\')[0].classList.remove(\'fullscreen\')'
+ "document.getElementsByTagName('html')[0].classList.remove('fullscreen')"
)
)
mainWindow.on('blur', () =>
mainWindow.webContents.executeJavaScript(
- 'document.getElementsByTagName(\'html\')[0].classList.add(\'blur\')'
+ "document.getElementsByTagName('html')[0].classList.add('blur')"
)
)
mainWindow.on('focus', () =>
mainWindow.webContents.executeJavaScript(
- 'document.getElementsByTagName(\'html\')[0].classList.remove(\'blur\')'
+ "document.getElementsByTagName('html')[0].classList.remove('blur')"
)
)
}
@@ -191,10 +191,10 @@ const switchTheme = () => {
isDarkMode
? mainWindow.webContents.executeJavaScript(
- 'document.getElementsByTagName(\'html\')[0].classList.add(\'dark\')'
+ "document.getElementsByTagName('html')[0].classList.add('dark')"
)
: mainWindow.webContents.executeJavaScript(
- 'document.getElementsByTagName(\'html\')[0].classList.remove(\'dark\')'
+ "document.getElementsByTagName('html')[0].classList.remove('dark')"
)
}
}
diff --git a/src/renderer/App.css b/src/renderer/App.css
deleted file mode 100644
index ea9ad65..0000000
--- a/src/renderer/App.css
+++ /dev/null
@@ -1,96 +0,0 @@
-*,
-*::before,
-*::after {
- box-sizing: border-box;
-}
-
-html,
-body {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- background: #fcfcfc !important;
- overflow: hidden;
-}
-
-html.dark,
-.dark body {
- background: #141414 !important;
-}
-
-html {
- font-size: 13px;
-}
-
-html.fullscreen {
- font-size: 24px;
-}
-
-#root {
- height: 100%;
- position: relative;
- font-size: 1rem;
- line-height: 1.3;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu,
- Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
- 'Segoe UI Symbol';
- font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'pnum' 1, 'tnum' 0,
- 'onum' 0, 'lnum' 0, 'dlig' 1;
- color: #303030;
- transform: translate3d(0, 0, 0);
- -webkit-app-region: drag;
- -webkit-user-select: none;
-}
-
-.dark #root {
- color: #e2e2e2;
-}
-
-h1,
-h2,
-h3,
-h4,
-h5 {
- font-weight: 700;
-}
-
-a,
-button {
- text-decoration: none;
- cursor: default;
-}
-
-a h1 {
- color: unset;
-}
-
-.app {
- padding: 10% 7% 5% 7%;
- cursor: default;
- transition: .15s ease-out;
- width: 100%;
- height: 100%;
- overflow-y: auto;
-}
-
-.darwin .app {
- padding-top: calc(35px + 10%);
-}
-
-.fullscreen.darwin .app {
- transform: translate3d(0, -36px, 0);
-}
-
-.box {
- width: 100%;
- padding: 5%;
- background: #fff;
- border-radius: 5px;
- border: .1rem solid #e2e2e2;
-}
-
-.dark .box {
- background: #222;
- border-color: #303030;
-}
diff --git a/src/renderer/App.jsx b/src/renderer/App.jsx
index b04c4e6..6454683 100644
--- a/src/renderer/App.jsx
+++ b/src/renderer/App.jsx
@@ -10,10 +10,10 @@ import {
import { webFrame, ipcRenderer } from 'electron'
import posed, { PoseGroup } from 'react-pose'
import Titlebar from './components/Titlebar'
+import { defaultAnimation } from './components/Animations'
import Home from './screens/Home'
import Preferences from './screens/Preferences'
-import './App.css'
-import { defaultAnimation } from './components/Animations'
+import styles from './App.module.css'
//
// Disable zooming
@@ -55,7 +55,7 @@ export default class App extends PureComponent {
return (
<>
{process.platform === 'darwin' && }
-
+
diff --git a/src/renderer/App.module.css b/src/renderer/App.module.css
new file mode 100644
index 0000000..fee0a99
--- /dev/null
+++ b/src/renderer/App.module.css
@@ -0,0 +1,16 @@
+.app {
+ padding: 10% 7% 5% 7%;
+ cursor: default;
+ transition: 0.15s ease-out;
+ width: 100%;
+ height: 100%;
+ overflow-y: auto;
+}
+
+:global(.darwin) .app {
+ padding-top: calc(35px + 10%);
+}
+
+:global(.fullscreen.darwin) .app {
+ transform: translate3d(0, -36px, 0);
+}
diff --git a/src/renderer/components/Account.jsx b/src/renderer/components/Account.jsx
deleted file mode 100644
index b4751b4..0000000
--- a/src/renderer/components/Account.jsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import React, { PureComponent } from 'react'
-import PropTypes from 'prop-types'
-import { openUrl } from '../../utils'
-import Balance from './Balance'
-
-export default class Account extends PureComponent {
- static propTypes = {
- account: PropTypes.shape({
- address: PropTypes.string.isRequired,
- balance: PropTypes.object.isRequired
- })
- }
-
- render() {
- const { account } = this.props
- const { balance, address } = account
-
- return (
-
- )
- }
-}
diff --git a/src/renderer/components/Balance.jsx b/src/renderer/components/Balance.jsx
index ee0feac..fff8df0 100644
--- a/src/renderer/components/Balance.jsx
+++ b/src/renderer/components/Balance.jsx
@@ -1,30 +1,36 @@
-import React, { PureComponent } from 'react'
+import React, { useContext } from 'react'
import PropTypes from 'prop-types'
import posed, { PoseGroup } from 'react-pose'
import { AppContext } from '../store/createContext'
import { cryptoFormatter } from '../../utils'
-import styles from './Balance.module.scss'
import { fadeIn } from './Animations'
+import Label from './Label'
+import styles from './Balance.module.css'
const Animation = posed.h1(fadeIn)
-export default class Balance extends PureComponent {
- static contextType = AppContext
+const Balance = ({ balance, label, large }) => {
+ const { currency } = useContext(AppContext)
- static propTypes = {
- balance: PropTypes.object.isRequired
- }
-
- render() {
- const { currency } = this.context
- const { balance } = this.props
-
- return (
+ return (
+
-
+
{cryptoFormatter(balance[currency], currency)}
- )
- }
+ {label &&
}
+
+ )
}
+
+Balance.propTypes = {
+ balance: PropTypes.object.isRequired,
+ label: PropTypes.string,
+ large: PropTypes.bool
+}
+
+export default Balance
diff --git a/src/renderer/components/Balance.module.css b/src/renderer/components/Balance.module.css
new file mode 100644
index 0000000..5099139
--- /dev/null
+++ b/src/renderer/components/Balance.module.css
@@ -0,0 +1,33 @@
+.balance {
+ text-align: center;
+ width: 100%;
+}
+
+.number {
+ margin: 0;
+ -webkit-app-region: no-drag;
+ -webkit-user-select: text;
+ font-size: 1rem;
+ display: inline-block;
+ padding: 0 0.3rem;
+ border-radius: 4px;
+}
+
+.numberLarge {
+ composes: number;
+ font-size: 2.5rem;
+}
+
+.updated {
+ animation: updated 0.5s ease-out;
+}
+
+@keyframes updated {
+ 0% {
+ background: rgba(255, 255, 255, 0.2);
+ }
+
+ 100% {
+ background: rgba(255, 255, 255, 0);
+ }
+}
diff --git a/src/renderer/components/Balance.module.scss b/src/renderer/components/Balance.module.scss
deleted file mode 100644
index 02fcd70..0000000
--- a/src/renderer/components/Balance.module.scss
+++ /dev/null
@@ -1,27 +0,0 @@
-.number {
- margin: 0;
- -webkit-app-region: no-drag;
- -webkit-user-select: text;
- font-size: 1rem;
- display: inline-block;
- padding: 0 .3rem;
- border-radius: 4px;
-
- :global(.number-unit--main) & {
- font-size: 2.5rem;
- }
-}
-
-.updated {
- animation: updated .5s ease-out;
-}
-
-@keyframes updated {
- 0% {
- background: rgba(255, 255, 255, .2);
- }
-
- 100% {
- background: rgba(255, 255, 255, 0);
- }
-}
diff --git a/src/renderer/components/Divider.jsx b/src/renderer/components/Divider.jsx
new file mode 100644
index 0000000..a9c1e8c
--- /dev/null
+++ b/src/renderer/components/Divider.jsx
@@ -0,0 +1,6 @@
+import React from 'react'
+import styles from './Divider.module.css'
+
+const Divider = () =>
+
+export default Divider
diff --git a/src/renderer/components/Divider.module.css b/src/renderer/components/Divider.module.css
new file mode 100644
index 0000000..213d994
--- /dev/null
+++ b/src/renderer/components/Divider.module.css
@@ -0,0 +1,11 @@
+.divider {
+ width: 100%;
+ height: 1px;
+ background: #e2e2e2;
+ margin-top: 5%;
+ border: 0;
+}
+
+:global(.dark) .divider {
+ background: #303030;
+}
diff --git a/src/renderer/components/Label.jsx b/src/renderer/components/Label.jsx
new file mode 100644
index 0000000..2681aa3
--- /dev/null
+++ b/src/renderer/components/Label.jsx
@@ -0,0 +1,15 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import styles from './Label.module.css'
+
+const Label = ({ children, ...props }) => (
+
+ {children}
+
+)
+
+Label.propTypes = {
+ children: PropTypes.any.isRequired
+}
+
+export default Label
diff --git a/src/renderer/components/Label.module.css b/src/renderer/components/Label.module.css
new file mode 100644
index 0000000..ab262ca
--- /dev/null
+++ b/src/renderer/components/Label.module.css
@@ -0,0 +1,7 @@
+.label {
+ color: #8b98a9;
+ font-size: 0.85rem;
+ display: block;
+ white-space: nowrap;
+ margin-top: 0.5rem;
+}
diff --git a/src/renderer/components/Spinner.jsx b/src/renderer/components/Spinner.jsx
index 14e53de..5e8310a 100644
--- a/src/renderer/components/Spinner.jsx
+++ b/src/renderer/components/Spinner.jsx
@@ -1,5 +1,5 @@
import React from 'react'
-import styles from './Spinner.module.scss'
+import styles from './Spinner.module.css'
const Spinner = () =>
diff --git a/src/renderer/components/Spinner.module.css b/src/renderer/components/Spinner.module.css
new file mode 100644
index 0000000..ed36c44
--- /dev/null
+++ b/src/renderer/components/Spinner.module.css
@@ -0,0 +1,28 @@
+.spinner {
+ position: relative;
+ text-align: center;
+ margin: auto;
+ width: 100%;
+}
+
+.spinner::before {
+ content: '';
+ box-sizing: border-box;
+ position: absolute;
+ top: 0;
+ left: 50%;
+ width: 20px;
+ height: 20px;
+ margin-top: -20px;
+ margin-left: -10px;
+ border-radius: 50%;
+ border: 2px solid #7b1173;
+ border-top-color: #e000cf;
+ animation: spinner 0.6s linear infinite;
+}
+
+@keyframes spinner {
+ to {
+ transform: rotate(360deg);
+ }
+}
diff --git a/src/renderer/components/Spinner.module.scss b/src/renderer/components/Spinner.module.scss
deleted file mode 100644
index b01c1a0..0000000
--- a/src/renderer/components/Spinner.module.scss
+++ /dev/null
@@ -1,28 +0,0 @@
-.spinner {
- position: relative;
- text-align: center;
- margin: auto;
- width: 100%;
-
- &::before {
- content: '';
- box-sizing: border-box;
- position: absolute;
- top: 0;
- left: 50%;
- width: 20px;
- height: 20px;
- margin-top: -20px;
- margin-left: -10px;
- border-radius: 50%;
- border: 2px solid #7b1173;
- border-top-color: #e000cf;
- animation: spinner .6s linear infinite;
- }
-}
-
-@keyframes spinner {
- to {
- transform: rotate(360deg);
- }
-}
diff --git a/src/renderer/components/Ticker.css b/src/renderer/components/Ticker.css
deleted file mode 100644
index 67b2bc3..0000000
--- a/src/renderer/components/Ticker.css
+++ /dev/null
@@ -1,56 +0,0 @@
-.ticker {
- margin-top: 3rem;
- width: 100%;
-}
-
-.ticker .number-unit {
- margin-top: 0;
-}
-
-.ticker button {
- background: none;
- border: 1px solid #e2e2e2;
- box-shadow: none;
- margin: 0 auto;
- outline: 0;
- font-size: .75rem;
- border-radius: .3rem;
- padding: .3rem .4rem;
- display: block;
- width: 100%;
- max-width: 12rem;
- transition: border .2s ease-out;
- color: #41474e;
-}
-
-.ticker button:disabled {
- pointer-events: none;
-}
-
-.dark .ticker button {
- border-color: #303030;
- color: #8b98a9;
-}
-
-.label--price {
- font-size: .95rem;
-}
-
-.change {
- font-size: .65rem;
- display: inline-block;
- margin-left: .25rem;
-}
-
-.change--positive {
- color: forestgreen;
-}
-
-.change--negative {
- color: crimson;
-}
-
-.active .change--positive,
-.active .change--negative {
- color: #fff !important;
-}
diff --git a/src/renderer/components/Ticker.jsx b/src/renderer/components/Ticker.jsx
deleted file mode 100644
index 8183b29..0000000
--- a/src/renderer/components/Ticker.jsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import React, { PureComponent } from 'react'
-import PropTypes from 'prop-types'
-import posed, { PoseGroup } from 'react-pose'
-import { AppContext } from '../store/createContext'
-import { cryptoFormatter } from '../../utils'
-import './Ticker.css'
-import { fadeIn } from './Animations'
-
-const Item = posed.div(fadeIn)
-
-const Change = ({ currency }) => (
-
- {({ priceChanges }) => {
- const isNegative = JSON.stringify(priceChanges[currency]).startsWith('-')
- let classes = isNegative ? 'change--negative' : 'change--positive'
-
- return (
-
- {!isNegative && '+'}
- {Number(priceChanges[currency]).toFixed(1)}%
-
- )
- }}
-
-)
-
-Change.propTypes = {
- currency: PropTypes.string.isRequired
-}
-
-export default class Ticker extends PureComponent {
- static contextType = AppContext
-
- items = () => {
- const {
- prices,
- needsConfig,
- currency,
- toggleCurrencies,
- accentColor
- } = this.context
-
- const activeStyle = {
- backgroundColor: accentColor,
- color: '#fff',
- borderColor: accentColor
- }
-
- // convert Map to array first, cause for...of or forEach returns
- // undefined, so it cannot be mapped to a collection of elements
- return [...prices.entries()].map(([key, value]) => (
- -
-
-
- ))
- }
-
- render() {
- return (
-
- )
- }
-}
diff --git a/src/renderer/components/Titlebar.jsx b/src/renderer/components/Titlebar.jsx
index fc1daa0..d0d1acf 100644
--- a/src/renderer/components/Titlebar.jsx
+++ b/src/renderer/components/Titlebar.jsx
@@ -1,6 +1,6 @@
import React from 'react'
import pkg from '../../../package.json'
-import styles from './Titlebar.module.scss'
+import styles from './Titlebar.module.css'
const Titlebar = () => (