diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fonts/roboto/roboto-latin.woff2 | bin | 0 -> 10740 bytes | |||
-rw-r--r-- | src/images/icons/moon.svg | 1 | ||||
-rw-r--r-- | src/images/icons/sun.svg | 1 | ||||
-rw-r--r-- | src/js/switch-storage.js | 13 | ||||
-rw-r--r-- | src/scss/styles/_base.scss | 153 | ||||
-rw-r--r-- | src/scss/styles/_switch.scss | 57 | ||||
-rw-r--r-- | src/scss/styles/_tipografia.scss | 16 | ||||
-rw-r--r-- | src/scss/styles/_variables.scss | 64 | ||||
-rw-r--r-- | src/scss/styles/home.scss | 13 | ||||
-rw-r--r-- | src/scss/styles/home/_buttons.scss | 24 | ||||
-rw-r--r-- | src/scss/styles/normalize.scss | 349 | ||||
-rw-r--r-- | src/scss/styles/post.scss | 12 |
12 files changed, 703 insertions, 0 deletions
diff --git a/src/fonts/roboto/roboto-latin.woff2 b/src/fonts/roboto/roboto-latin.woff2 Binary files differnew file mode 100644 index 0000000..d4bf378 --- /dev/null +++ b/src/fonts/roboto/roboto-latin.woff2 diff --git a/src/images/icons/moon.svg b/src/images/icons/moon.svg new file mode 100644 index 0000000..fd32d1e --- /dev/null +++ b/src/images/icons/moon.svg @@ -0,0 +1 @@ +<svg width="12" height="12" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.492 10.511a8.177 8.177 0 0 1-1.877-8.593c.103-.281-.215-.53-.464-.364a8.16 8.16 0 0 0-1.31 1.09C.724 5.842.764 10.984 3.93 14.135a8.102 8.102 0 0 0 11.465-.024c.389-.39.73-.81 1.024-1.254a.31.31 0 0 0-.366-.461 8.102 8.102 0 0 1-8.56-1.885Z" fill="#FFD900"/><path d="M16.052 12.396a8.104 8.104 0 0 1-1.808.44 8.102 8.102 0 0 1-11-.409 8.13 8.13 0 0 1-1.422-1.905 8.115 8.115 0 0 0 2.107 3.613 8.102 8.102 0 0 0 11.465-.024c.389-.39.73-.81 1.024-1.254a.31.31 0 0 0-.366-.461Z" fill="#FB0"/></svg> diff --git a/src/images/icons/sun.svg b/src/images/icons/sun.svg new file mode 100644 index 0000000..bf8f032 --- /dev/null +++ b/src/images/icons/sun.svg @@ -0,0 +1 @@ +<svg width="12" height="12" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.4 1.8a.6.6 0 0 0 1.2 0V.6a.6.6 0 0 0-1.2 0v1.2Zm0 15.6a.6.6 0 1 0 1.2 0v-1.2a.6.6 0 0 0-1.2 0v1.2Zm7.8-9a.6.6 0 0 0 0 1.2h1.2a.6.6 0 1 0 0-1.2h-1.2ZM.6 8.4a.6.6 0 1 0 0 1.2h1.2a.6.6 0 0 0 0-1.2H.6Zm8.4 6A5.4 5.4 0 1 0 9 3.6a5.4 5.4 0 0 0 0 10.8Zm4.667-10.916a.6.6 0 1 0 .848.849l.849-.849a.6.6 0 0 0-.849-.848l-.848.848ZM2.636 14.515a.6.6 0 1 0 .848.849l.849-.849a.6.6 0 1 0-.849-.848l-.848.848Zm11.879-.848a.6.6 0 1 0-.848.848l.848.849a.6.6 0 0 0 .849-.849l-.849-.848ZM3.484 2.636a.6.6 0 1 0-.848.848l.848.849a.6.6 0 1 0 .849-.849l-.849-.848Z" fill="#FFD900"/><path d="M9 3.6c-.14 0-.28.005-.416.016a5.4 5.4 0 0 1 0 10.768A5.4 5.4 0 1 0 9 3.6Z" fill="#FB0"/><path d="M1.8 8.4H.967a.6.6 0 0 1 0 1.2H1.8a.6.6 0 0 0 0-1.2Zm15.6 0h-.833a.6.6 0 1 1 0 1.2h.833a.6.6 0 1 0 0-1.2ZM9 0a.598.598 0 0 0-.416.169.601.601 0 0 1 .183.431v1.2c0 .17-.07.322-.183.431A.6.6 0 0 0 9.6 1.8V.6a.6.6 0 0 0-.601-.6Zm0 15.6a.597.597 0 0 0-.416.169.601.601 0 0 1 .183.431v1.2c0 .17-.07.322-.183.431A.6.6 0 0 0 9.6 17.4v-1.2a.6.6 0 0 0-.601-.6Zm6.364-12.964a.6.6 0 0 0-.841-.007l.008.007a.6.6 0 0 1 0 .849l-.849.848-.008.007a.6.6 0 0 0 .841-.007l.849-.848a.6.6 0 0 0 0-.849Zm0 11.879-.849-.848a.6.6 0 0 0-.84-.007l.007.007.849.848a.6.6 0 0 1 0 .849l-.008.007a.6.6 0 0 0 .84-.856ZM4.333 3.485l-.849-.849a.6.6 0 0 0-.84-.008l.01.008.848.849a.6.6 0 0 1 0 .848l-.009.008a.6.6 0 0 0 .84-.857Zm0 10.182a.6.6 0 0 0-.84-.008l.009.008a.6.6 0 0 1 0 .848l-.849.849-.008.008a.6.6 0 0 0 .84-.008l.848-.849a.6.6 0 0 0 0-.848Z" fill="#FFD900"/></svg>
\ No newline at end of file diff --git a/src/js/switch-storage.js b/src/js/switch-storage.js new file mode 100644 index 0000000..fb200c4 --- /dev/null +++ b/src/js/switch-storage.js @@ -0,0 +1,13 @@ +// This code is only used to remember theme selection +const themeSwitch = document.getElementById('theme-switch'); +themeSwitch.checked = localStorage.getItem('switchedTheme') === 'true'; + +themeSwitch.addEventListener('change', function (e) { + if(e.currentTarget.checked === true) { + localStorage.setItem('switchedTheme', 'true'); + console.info('Add light theme to localstorage'); + } else { + localStorage.removeItem('switchedTheme'); + console.info('Remove light theme of localstorage'); + } +}); diff --git a/src/scss/styles/_base.scss b/src/scss/styles/_base.scss new file mode 100644 index 0000000..5af7492 --- /dev/null +++ b/src/scss/styles/_base.scss @@ -0,0 +1,153 @@ +body { + margin: 0px; + padding: 0px; + height: 100vh; +} + +.page { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: repeat(2, auto); + grid-gap: 0px 0px; + grid-auto-flow: row; + grid-template-areas: + "aside" + "main"; + background-color: var(--s-background); +} + +.aside { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: repeat(4, auto); + grid-gap: 1rem; + grid-template-areas: + "title" + "subtitle" + "form" + "a-nav" + "a-social"; + grid-area: aside; + background-color: var(--p-background); + justify-items: center; + align-content: start; + padding: 1rem 0px; + color: var(--aside-text); +} +.title { grid-area: title; } +.subtitle { grid-area: subtitle; } +.form { grid-area: form; } +.a-nav { grid-area: a-nav; } +.a-social { grid-area: a-social; } +.main { + grid-area: main; + color: var(--text); +} + +a { + cursor: pointer; + color: var(--link); + text-decoration: none; +} + +a:visited { + color: var(--link-visited); +} + +a:hover { + color: var(--link-hover); +} + +input[type="search"] { + background: var(--p-background); + color: var(--search-text); + width: 100%; + border-bottom: 1px solid var(--border); + border-top: 0px; + border-left: 0px; + border-right: 0px; + border-radius: 0px; + padding: 0.4rem 0.4rem; + outline: none; + box-shadow: none; +} + +.search-box { + text-align: center; +} + +.aside h1 { + margin: 1rem 0 0.5rem; +} + +.aside > nav > ul { + display: grid; + grid-template-columns: repeat(2, auto); + grid-gap: 1rem; + list-style-type: none; + margin: 0; + padding: 0; + justify-items: center; + align-items: center; +} + +.aside p { + margin: 0px 0px 1rem; + font-size: 0.95rem; +} + +.main nav { + text-align: center; + text-transform: uppercase; + padding: 1rem 0px; + border-bottom: 1px solid var(--border); +} + +.main nav a { + font-size: 0.8rem; + padding: 0 0.2rem; +} + +.main article { + margin: 0 8% 2%; +} + +.main footer { + display: grid; + justify-items: center; + padding-top: 0.2rem; + border-top: 1px solid var(--border); +} + +.main footer.credits p { + display: block; + text-align: center; +} + +hr { + border: 1px solid var(--border); + margin-top: 2rem; + margin-bottom: 2rem; +} + +@media (min-width: 768px) { + .page { + display: block; + } + .aside { + width: 25vw; + height: 100vh; + position: fixed; + z-index: 2; + top: 0; + left: 0; + } + .main { + min-height: 100vh; + position: relative; + padding-left: 25vw; + } + .main article { + max-width: 760px; + } +} diff --git a/src/scss/styles/_switch.scss b/src/scss/styles/_switch.scss new file mode 100644 index 0000000..7361ee5 --- /dev/null +++ b/src/scss/styles/_switch.scss @@ -0,0 +1,57 @@ +.theme-switch { + display: none; +} + +label[for=theme-switch] { + cursor: pointer; +} + +.theme-switch:checked ~ .page { + --text: var(--light-text); + --aside-text: var(--light-aside-text); + --p-background: var(--light-p-bg); + --s-background: var(--light-s-bg); + --link: var(--light-link); + --link-visited: var(--light-link-visited); + --link-hover: var(--light-link-hover); + --border: var(--light-border); + --button: var(--light-button); + --button-text: var(--light-button-text); + --button-hover: var(--light-button-hover); + --button-border: var(--light-button-border); + --search-text: var(--light-search-text); + --switch-icon: var(--light-switch-icon); + --switch-shadow-color: var(--light-switch-shadow); + --switch-p-bg: var(--light-switch-p-bg); + --switch-s-bg: var(--light-switch-s-bg); + --switch-border: var(--light-switch-border); + --switch-transform: var(--light-switch-transform); +} + +.switch-label { + display: inline-flex; + width: 35px; + height: 1rem; + border-radius: 1rem; + background-color: var(--switch-p-bg); + align-items: center; + align-content: center; +} + +.switch-label::before { + content: var(--switch-icon); + position: relative; + transition: text-shadow .2s; + background: var(--switch-s-bg); + border: 1px solid var(--switch-border); + border-radius: 50%; + transform: var(--switch-transform); + width: 18px; + height: 18px; +} + +.theme-switch:focus ~ .page .switch-label::before, +.switch-label:hover::before { + text-shadow: 0 0 15px var(--switch-shadow-color); + transition: transform 0.25s; +} diff --git a/src/scss/styles/_tipografia.scss b/src/scss/styles/_tipografia.scss new file mode 100644 index 0000000..4a9f3d4 --- /dev/null +++ b/src/scss/styles/_tipografia.scss @@ -0,0 +1,16 @@ +/* latin */ +@font-face { + font-family: 'Roboto Condensed'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: local('Roboto Condensed'), + local('RobotoCondensed-Regular'), + url(../fonts/roboto/roboto-latin.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} + +/* html/body/font-fixes */ +body, input, textarea, .button { + font-family: 'Roboto Condensed', Nimbus Sans, sans-serif; +} diff --git a/src/scss/styles/_variables.scss b/src/scss/styles/_variables.scss new file mode 100644 index 0000000..69c1662 --- /dev/null +++ b/src/scss/styles/_variables.scss @@ -0,0 +1,64 @@ +:root { + /* Light mode */ + --light-text: #000000; + --light-aside-text: #FFFFFF; + --light-p-bg: #080808; + --light-s-bg: #FFFFFF; + --light-link: #1976D2; + --light-link-visited: #7755FF; + --light-link-hover: #FFC20E; + --light-border: #1976D2; + --light-button: #004BA0; + --light-button-text: #FFFFFF; + --light-button-hover: #1976D2; + --light-button-border: #080808; + --light-search-text: #FFFFFF; + --light-switch-icon: url("/dist/images/icons/sun.svg"); + --light-switch-shadow: #373D4E; + --light-switch-p-bg: #1976d2; + --light-switch-s-bg: #FFFFFF; + --light-switch-border: #1976d2; + --light-switch-transform: translate(0%, 0%); + + /* Dark mode */ + --dark-text: #FFFFFF; + --dark-aside-text: #FFFFFF; + --dark-p-bg: #080808; + --dark-s-bg: #101010; + --dark-link: #1976D2; + --dark-link-visited: #7755FF; + --dark-link-hover: #FFC20E; + --dark-border: #1976D2; + --dark-button: #004BA0; + --dark-button-text: #FFFFFF; + --dark-button-hover: #1976D2; + --dark-button-border: #080808; + --dark-search-text: #FFFFFF; + --dark-switch-icon: url("/dist/images/icons/moon.svg"); + --dark-switch-shadow: #FCE477; + --dark-switch-p-bg: #1976d2; + --dark-switch-s-bg: #080808; + --dark-switch-border: #1976d2; + --dark-switch-transform: translate(74%, 0%); + + /* Default mode */ + --text: var(--dark-text); + --aside-text: var(--dark-aside-text); + --p-background: var(--dark-p-bg); + --s-background: var(--dark-s-bg); + --link: var(--dark-link); + --link-visited: var(--dark-link-visited); + --link-hover: var(--dark-link-hover); + --border: var(--dark-border); + --button: var(--dark-button); + --button-text: var(--dark-button-text); + --button-hover: var(--dark-button-hover); + --button-border: var(--dark-button-border); + --search-text: var(--dark-search-text); + --switch-icon: var(--dark-switch-icon); + --switch-shadow-color: var(--dark-switch-shadow); + --switch-p-bg: var(--dark-switch-p-bg); + --switch-s-bg: var(--dark-switch-s-bg); + --switch-border: var(--dark-switch-border); + --switch-transform: var(--dark-switch-transform); +} diff --git a/src/scss/styles/home.scss b/src/scss/styles/home.scss new file mode 100644 index 0000000..52b5f7a --- /dev/null +++ b/src/scss/styles/home.scss @@ -0,0 +1,13 @@ +@charset "utf-8"; +/*! + * Single CSS - Home + * Author: Jesus E. + * Version: 1.0.0 + * Licensed under GPLv3 (https://www.gnu.org/licenses/gpl-3.0.txt) + */ + +@import "variables"; +@import 'tipografia'; +@import "switch"; +@import "base"; +@import "home/_buttons.scss"; diff --git a/src/scss/styles/home/_buttons.scss b/src/scss/styles/home/_buttons.scss new file mode 100644 index 0000000..64f7a54 --- /dev/null +++ b/src/scss/styles/home/_buttons.scss @@ -0,0 +1,24 @@ +.button-container > a.button { + display: flex; + background-color: var(--button); + border-color: var(--button-border); + border-width: 1px; + box-shadow: none; + color: var(--button-text); + cursor: pointer; + margin: 1rem 0; + padding: 0.6rem; + text-align: center; + white-space: nowrap; + justify-content: center; +} + +.button-container > a.button:hover { + background-color: var(--button-hover); +} + +@media (min-width: 768px) { + .button-container > a.button { + display: inline-block; + } +} diff --git a/src/scss/styles/normalize.scss b/src/scss/styles/normalize.scss new file mode 100644 index 0000000..192eb9c --- /dev/null +++ b/src/scss/styles/normalize.scss @@ -0,0 +1,349 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/src/scss/styles/post.scss b/src/scss/styles/post.scss new file mode 100644 index 0000000..5f411a0 --- /dev/null +++ b/src/scss/styles/post.scss @@ -0,0 +1,12 @@ +@charset "utf-8"; +/*! + * Single CSS - Post + * Author: Jesus E. + * Version: 1.0.0 + * Licensed under GPLv3 (https://www.gnu.org/licenses/gpl-3.0.txt) + */ + +@import "variables"; +@import 'tipografia'; +@import "switch"; +@import "base"; |