From 46ca8c38345989c9df5ed50c41dc4938ad305995 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 12 Aug 2020 01:44:47 +0200 Subject: [PATCH] Update style a bit --- src/components/Elements/HZero.js | 10 --- src/components/Elements/HZero.less | 9 --- src/components/Elements/Image.js | 5 +- src/components/Elements/Image.less | 5 ++ src/components/Elements/Timer.less | 11 ++- src/components/Elements/Todo.less | 7 +- src/components/Panels/Box.less | 16 ++--- src/components/Panels/Panel.js | 5 +- src/components/Panels/Panel.less | 10 --- src/components/Panels/Section.js | 5 +- src/components/Rendering/Markdown.less | 2 +- src/index.js | 2 - src/routes/Sample.js | 32 ++++++--- src/styles/constants.less | 15 ---- src/styles/mixins.less | 39 +++------- src/styles/theme.less | 99 +++++--------------------- 16 files changed, 82 insertions(+), 190 deletions(-) delete mode 100644 src/components/Elements/HZero.js delete mode 100644 src/components/Elements/HZero.less create mode 100644 src/components/Elements/Image.less delete mode 100644 src/components/Panels/Panel.less diff --git a/src/components/Elements/HZero.js b/src/components/Elements/HZero.js deleted file mode 100644 index 782233b..0000000 --- a/src/components/Elements/HZero.js +++ /dev/null @@ -1,10 +0,0 @@ -import style from "./HZero.less"; -import concatClass from "../../utils/concatClass"; - -export default function (props) { - return ( -
- {props.children} -
- ); -} diff --git a/src/components/Elements/HZero.less b/src/components/Elements/HZero.less deleted file mode 100644 index 4dd24b5..0000000 --- a/src/components/Elements/HZero.less +++ /dev/null @@ -1,9 +0,0 @@ -@import "../../styles/constants.less"; - -.h0 { - display: block; - text-align: center; - color: @accent; - font-family: @title; - font-size: 48px; -} diff --git a/src/components/Elements/Image.js b/src/components/Elements/Image.js index 7402043..361712a 100644 --- a/src/components/Elements/Image.js +++ b/src/components/Elements/Image.js @@ -1,7 +1,10 @@ +import style from "./Image.less"; +import {concatClass} from "../../index"; + export default function(props) { return ( - {props.alt} + {props.alt} ) } diff --git a/src/components/Elements/Image.less b/src/components/Elements/Image.less new file mode 100644 index 0000000..03b1b3a --- /dev/null +++ b/src/components/Elements/Image.less @@ -0,0 +1,5 @@ +.img { + max-width: 100%; + max-height: 300px; + border-radius: 4px; +} \ No newline at end of file diff --git a/src/components/Elements/Timer.less b/src/components/Elements/Timer.less index 9c70928..a1f992b 100644 --- a/src/components/Elements/Timer.less +++ b/src/components/Elements/Timer.less @@ -1,3 +1,4 @@ +@import "../../styles/mixins.less"; @import "../../styles/constants.less"; .timer { @@ -9,8 +10,8 @@ margin-bottom: 8px; padding: 8px; grid-template-columns: 80px 80px 80px 80px; - border: 2px solid @plusplus; - border-radius: 4px; + + .bordered(@fg, @bg); } .days { @@ -41,8 +42,7 @@ } .unknown { - color: @magenta; - border: 2px solid fade(@magenta, 20%); + .bordered(@magenta, @bg); .count { color: @magenta; @@ -50,8 +50,7 @@ } .expired { - color: @red; - border: 2px solid fade(@red, 20%); + .bordered(@red, @bg); .count { color: @red; diff --git a/src/components/Elements/Todo.less b/src/components/Elements/Todo.less index 3268d79..12d9713 100644 --- a/src/components/Elements/Todo.less +++ b/src/components/Elements/Todo.less @@ -1,9 +1,6 @@ +@import "../../styles/mixins.less"; @import "../../styles/constants.less"; .todo { - border: 1px yellow solid; - border-radius: 2px; - padding: 1px; - background-color: black; - color: yellow; + .bordered(yellow, black); } diff --git a/src/components/Panels/Box.less b/src/components/Panels/Box.less index 68f0d72..7481bf6 100644 --- a/src/components/Panels/Box.less +++ b/src/components/Panels/Box.less @@ -9,41 +9,41 @@ } .default { - background-color: fade(@fg, 5%); + border: 2px solid fade(@fg, 10%); color: @fg; } .red { - background-color: fade(@red, 5%); + border: 2px solid fade(@red, 10%); color: @red; } .orange { - background-color: fade(@orange, 5%); + border: 2px solid fade(@orange, 10%); color: @orange; } .yellow { - background-color: fade(@yellow, 5%); + border: 2px solid fade(@yellow, 10%); color: @yellow; } .lime { - background-color: fade(@lime, 5%); + border: 2px solid fade(@lime, 10%); color: @lime; } .cyan { - background-color: fade(@cyan, 5%); + border: 2px solid fade(@cyan, 10%); color: @cyan; } .blue { - background-color: fade(@blue, 5%); + border: 2px solid fade(@blue, 10%); color: @blue; } .magenta { - background-color: fade(@magenta, 5%); + border: 2px solid fade(@magenta, 10%); color: @magenta; } diff --git a/src/components/Panels/Panel.js b/src/components/Panels/Panel.js index ca9ac06..5c3334b 100644 --- a/src/components/Panels/Panel.js +++ b/src/components/Panels/Panel.js @@ -1,13 +1,12 @@ -import style from "./Panel.less"; import Box from "./Box"; export default function(props) { return ( -

+

{props.title}

-
+
{props.children}
diff --git a/src/components/Panels/Panel.less b/src/components/Panels/Panel.less deleted file mode 100644 index d76c023..0000000 --- a/src/components/Panels/Panel.less +++ /dev/null @@ -1,10 +0,0 @@ -@import "../../styles/constants.less"; - -.title { - font-family: @title; - -} - -.contents { - font-family: @text; -} diff --git a/src/components/Panels/Section.js b/src/components/Panels/Section.js index 9d497a9..071cc77 100644 --- a/src/components/Panels/Section.js +++ b/src/components/Panels/Section.js @@ -1,15 +1,14 @@ import Split from "../Layout/Split"; -import {Fragment} from "preact"; export default function (props) { return ( - +

{props.title}

{props.children} - +
); } diff --git a/src/components/Rendering/Markdown.less b/src/components/Rendering/Markdown.less index ee7249a..15aad7f 100644 --- a/src/components/Rendering/Markdown.less +++ b/src/components/Rendering/Markdown.less @@ -7,6 +7,6 @@ h1 { padding-bottom: 2px; - border-bottom: 1px solid @plusplusplus; + border-bottom: 1px solid fade(@fg, 15%); } } diff --git a/src/index.js b/src/index.js index 908c0d7..1b408b7 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,6 @@ import FormButton from "./components/Forms/FormButton"; import FormInput from "./components/Forms/FormInput"; import FormRow from "./components/Forms/FormRow"; import getEventValue from "./utils/getEventValue"; -import HZero from "./components/Elements/HZero"; import ILatex from "./components/Rendering/ILatex"; import Image from "./components/Elements/Image"; import isString from "./utils/isString"; @@ -58,7 +57,6 @@ export { FormInput, FormRow, getEventValue, - HZero, ILatex, Image, isString, diff --git a/src/routes/Sample.js b/src/routes/Sample.js index 9eef3ef..e15683e 100644 --- a/src/routes/Sample.js +++ b/src/routes/Sample.js @@ -30,28 +30,44 @@ export default function (props) {
- This is a default panel. +

+ This is a default panel. +

- This is a red panel. +

+ This is a red panel. +

- This is a orange panel. +

+ This is a orange panel. +

- This is a yellow panel. +

+ This is a yellow panel. +

- This is a lime panel. +

+ This is a lime panel. +

- This is a cyan panel. +

+ This is a cyan panel. +

- This is a blue panel. +

+ This is a blue panel. +

- This is a magenta panel. +

+ This is a magenta panel. +

diff --git a/src/styles/constants.less b/src/styles/constants.less index bb46fb7..6d50573 100644 --- a/src/styles/constants.less +++ b/src/styles/constants.less @@ -1,7 +1,4 @@ @bg: #0d193b; -@bg-light: #142245; -@bg-lighter: #1c2b4f; -@bg-lightest: #233358; @fg: #a0ccff; @accent: #ffffff; @@ -9,11 +6,6 @@ @linkhover: #00ffff; @linkactive: #a0ffff; -@plus: fade(@fg, 5%); -@plusplus: fade(@fg, 10%); -@plusplusplus: fade(@fg, 15%); -@plusplusplusplus: fade(@fg, 20%); - @red: #ff7d7d; @orange: #ffbb7d; @yellow: #ffff7d; @@ -30,10 +22,3 @@ @warningbg: #231c00; @errorfg: @red; @errorbg: #330e00; - -@sans: "Arial", sans-serif; -@text: "Calibri", sans-serif; -@title: "Verdana", sans-serif; -@mono: "Consolas", "SFMono-Regular", "Liberation Mono", "Menlo", monospace; - -@example: #d3a1ff; diff --git a/src/styles/mixins.less b/src/styles/mixins.less index fab6989..3d888ab 100644 --- a/src/styles/mixins.less +++ b/src/styles/mixins.less @@ -1,43 +1,24 @@ -@import "constants.less"; - -.h(@hfg; @hbg) { +/// A bordered item +.bordered(@hfg; @hbg) { color: @hfg; background-color: @hbg; -} - -.hb(@hfg; @hbg) { - .h(@hfg; @hbg); border: 1px solid fade(@hfg, 10%); } -.hh(@hfg; @hbg) { - .hb(@hfg; @hbg); - +/// A hoverable element +.hoverable(@hfg, @hbg) { &:hover, &.hover { background-color: overlay(fade(@hfg, 10%), @hbg); border: 1px solid @hfg; - color: @hfg; - } - - &:active, &.active { - background-color: overlay(fade(@accent, 20%), @hbg); - border: 1px solid @accent; - color: @accent; + color: screen(@hfg, #808080); } } -.hnh(@hfg; @hbg) { - .hb(@hfg; @hbg); - - &:hover, &.hover { - background-color: @hbg; - border: 1px solid fade(@hfg, 10%); - color: @hfg; - } - +/// A clickable element +.clickable(@hfg, @hbg) { &:active, &.active { - background-color: @hbg; - border: 1px solid fade(@hfg, 10%); - color: @hfg; + background-color: overlay(rgba(255, 255, 255, 0.2), @hbg); + border: 1px solid white; + color: white; } } diff --git a/src/styles/theme.less b/src/styles/theme.less index 26e0ce5..63893ab 100644 --- a/src/styles/theme.less +++ b/src/styles/theme.less @@ -4,17 +4,14 @@ .bluelib { background-color: @bg; color: @fg; - font-family: @sans; + font-family: sans-serif; * { box-sizing: border-box; } h1, h2, h3, h4, h5, h6 { - margin-top: 4px; - margin-bottom: 4px; color: @accent; - font-family: @title; font-weight: normal; text-align: center; } @@ -37,119 +34,61 @@ } } - img, iframe { - max-width: 100%; - max-height: 300px; - border-radius: 4px; - } - pre, code { - font-family: @mono; + font-family: monospace; font-size: 14px; } blockquote { color: @fg; - border-left: 3px solid @plusplusplusplus; - background-color: @plus; + border-left: 3px solid fade(@fg, 20%); + background-color: fade(@fg, 5%); padding: 4px 4px 4px 8px; margin: 8px 0; } - input[type="text"], input[type="password"] { - .hb(@fg; @bg); + input:not([type="checkbox"]):not([type="radio"]) { + .bordered(@fg; @bg); border-radius: 4px; padding: 4px; font-size: medium; } - button { - .hh(@fg, @bg); + button, input[type="button"], input[type="submit"] { + .bordered(@fg; @bg); + + :not([disabled]) { + .hoverable(@fg; @bg); + .clickable(@fg; @bg); + } border-radius: 4px; padding: 4px; font-size: medium; } - .ok { - color: @okfg; - - input[type="text"], input[type="password"] { - .hb(@okfg; @okbg); - } - - button { - .hh(@okfg, @okbg); - } - } - - .warning { - color: @warningfg; - - input[type="text"], input[type="password"] { - .hb(@warningfg; @warningbg); - } - - button { - .hh(@warningfg, @warningbg); - } - } - - .error { - color: @errorfg; - - input[type="text"], input[type="password"] { - .hb(@errorfg; @errorbg); - } - - button { - .hh(@errorfg; @errorbg); - } - } - - .disabled { - color: @disabledfg; - cursor: not-allowed; - - input[type="text"], input[type="password"] { - .hb(@disabledfg; @disabledbg); - } - - button { - .hnh(@disabledfg, @disabledbg); - } - } - - input[type="text"][disabled], input[type="password"][disabled] { - .hb(@disabledfg; @disabledbg); - } - - button[disabled] { - .hnh(@disabledfg, @disabledbg); - } - hr { - border: 1px solid @plusplusplusplus; + border: 1px solid fade(@fg, 20%); margin-top: 24px; margin-bottom: 24px; } table { border-spacing: 0; - border: 2px solid @plusplus; - background-color: @plus; + border: 2px solid fade(@fg, 10%); + background-color: fade(@fg, 5%); border-collapse: collapse; thead, tbody { th, td { padding: 4px; - border: 1px solid @plusplus; + border: 1px solid fade(@fg, 10%); } } thead { - background-color: @plusplus; + background-color: fade(@fg, 10%); color: @accent; } } @@ -170,7 +109,7 @@ margin: 4px 0; padding: 4px; font-size: smaller; - background-color: @plus; + background-color: fade(@fg, 5%); border-radius: 4px; } }