diff --git a/gatsby-config.js b/gatsby-config.js index eae0cd33..79597b63 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -43,7 +43,12 @@ module.exports = { { resolve: `gatsby-remark-vscode`, options: { - theme: `Tomorrow`, + theme: { + default: `Tomorrow`, + parentSelector: { + "body.dark": "Tomorrow Night", + }, + }, extensions: [`elixir-ls`, `viml`, `vscode-themes/tomorrow`], }, }, @@ -150,5 +155,15 @@ module.exports = { ], }, }, + { + resolve: "gatsby-plugin-use-dark-mode", + options: { + classNameDark: "dark", + classNameLight: "light", + storageKey: "darkMode", + element: "html", + minify: true, + }, + }, ], }; diff --git a/package.json b/package.json index 9f17d241..6b4261df 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "gatsby-plugin-react-helmet": "^3.1.18", "gatsby-plugin-sharp": "^2.14.4", "gatsby-plugin-typescript": "^2.4.19", + "gatsby-plugin-use-dark-mode": "^1.3.0", "gatsby-remark-autolink-headers": "^2.2.3", "gatsby-remark-copy-linked-files": "^2.1.33", "gatsby-remark-external-links": "0.0.4", @@ -53,7 +54,9 @@ "react": "^16.12.0", "react-dom": "^16.12.0", "react-helmet": "^5.2.1", + "react-toggle-dark-mode": "^1.0.4", "typescript": "^4.3.5", + "use-dark-mode": "^2.3.1", "viml": "XadillaX/vscode-language-viml", "vscode-themes": "Microsoft/vscode-themes" }, diff --git a/src/components/DarkModeToggle.tsx b/src/components/DarkModeToggle.tsx new file mode 100644 index 00000000..f4f2f9f7 --- /dev/null +++ b/src/components/DarkModeToggle.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; + +import useDarkMode from "use-dark-mode"; +import { DarkModeSwitch } from "react-toggle-dark-mode"; + +function DarkModeToggle() { + const { value: isDarkMode, toggle: toggle } = useDarkMode(false, { + classNameDark: "dark", + classNameLight: "light", + }); + + return ( + + ); +} + +export default DarkModeToggle; diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 31f9bc8d..4d69bbd7 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -3,31 +3,36 @@ import * as React from "react"; function Footer() { return ( -
+
- + Home
{/* GitHub Logo SVG generated from Jekyll version of blog */} - @tmr08c + + @tmr08c +
- + Talks
- + {/* Logo thanks to https://www.svgrepo.com/svg/95552/rss-sign */} @@ -35,7 +40,7 @@ function Footer() { - + Blog
diff --git a/src/components/Header.tsx b/src/components/Header.tsx index e8cc49a2..71627662 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,6 +1,8 @@ import { Link, StaticQuery, graphql } from "gatsby"; import * as React from "react"; +import DarkModeToggle from "./DarkModeToggle"; + function Header(): JSX.Element { return ( ( -
diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 747d262f..ee766a6a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -10,7 +10,7 @@ class IndexPage extends React.Component<{}, {}> { render() { return ( <> -
+
{

- I am a Software Developer & Engineering Manager + Software Developer & Engineering Manager

diff --git a/src/pages/talks.tsx b/src/pages/talks.tsx index c95420ba..a6707b41 100644 --- a/src/pages/talks.tsx +++ b/src/pages/talks.tsx @@ -31,7 +31,7 @@ class TalksPage extends React.Component {

Talks

-
+
Below are some talks that I have given over time. When possible, I have provided links to slides and/or code.
diff --git a/src/templates/blog-post.tsx b/src/templates/blog-post.tsx index 0c1adc10..47e2ff38 100644 --- a/src/templates/blog-post.tsx +++ b/src/templates/blog-post.tsx @@ -47,7 +47,7 @@ const EditOnGitHubLink = ({ const linkToIssues = `${repoLink}/issues`; return ( -
+
Notice something wrong? Please consider{" "} { return ( -
+
{previous ? ( - + {previous.frontmatter.title} ) : ( )} - + - All Posts - {next ? ( {next.frontmatter.title} @@ -115,13 +119,13 @@ class BlogPostTemplate extends React.Component { return ( -
+

{post.frontmatter.title}

-
+
diff --git a/tailwind.config.js b/tailwind.config.js index d77c5ca9..8c69a35f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,6 +1,9 @@ +const colors = require("tailwindcss/colors"); + module.exports = { + darkMode: "class", theme: { - // Some useful comment + colors: colors, extend: { animation: { wiggle: "wiggle 3s ease-in-out infinite", @@ -28,13 +31,90 @@ module.exports = { }, }, }, + light: { + css: [ + { + color: theme("colors.gray.200"), + '[class~="lead"]': { + color: theme("colors.gray.300"), + }, + a: { + color: theme("colors.white"), + "&:hover": { + color: theme("colors.purple.400"), + }, + }, + strong: { + color: theme("colors.white"), + }, + "ol > li::before": { + color: theme("colors.gray.400"), + }, + "ul > li::before": { + backgroundColor: theme("colors.gray.600"), + }, + hr: { + borderColor: theme("colors.gray.200"), + }, + blockquote: { + color: theme("colors.gray.200"), + borderLeftColor: theme("colors.gray.600"), + }, + h1: { + color: theme("colors.white"), + }, + h2: { + color: theme("colors.white"), + }, + h3: { + color: theme("colors.white"), + }, + h4: { + color: theme("colors.white"), + }, + "figure figcaption": { + color: theme("colors.gray.400"), + }, + code: { + color: theme("colors.white"), + }, + "a code": { + color: theme("colors.white"), + }, + pre: false, + thead: { + color: theme("colors.white"), + borderBottomColor: theme("colors.gray.400"), + }, + "tbody tr": { + borderBottomColor: theme("colors.gray.600"), + }, + }, + ], + }, }), }, }, variants: { - textColor: ["responsive", "hover", "focus", "active", "group-hover"], - borderStyle: ["responsive", "hover", "focus", "active", "group-hover"], + textColor: [ + "dark", + "responsive", + "hover", + "focus", + "active", + "group-hover", + ], + borderWidth: ["dark"], + borderStyle: [ + "dark", + "responsive", + "hover", + "focus", + "active", + "group-hover", + ], animation: ["responsive", "hover", "motion-safe", "motion-reduce"], + typography: ["dark"], }, plugins: [require("@tailwindcss/typography")], // Using the built-in support for purging CSS diff --git a/yarn.lock b/yarn.lock index f8a90220..f0e7a418 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1802,6 +1802,91 @@ prop-types "^15.6.1" react-lifecycles-compat "^3.0.4" +"@react-spring/animated@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/animated/-/animated-9.2.4.tgz#062ecc0fdfef89f2541a42d8500428b70035f879" + integrity sha512-AfV6ZM8pCCAT29GY5C8/1bOPjZrv/7kD0vedjiE/tEYvNDwg9GlscrvsTViWR2XykJoYrDfdkYArrldWpsCJ5g== + dependencies: + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/core@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/core/-/core-9.2.4.tgz#275a4a065e3a315a4f5fb28c9a6f62ce718c25d6" + integrity sha512-R+PwyfsjiuYCWqaTTfCpYpRmsP0h87RNm7uxC1Uxy7QAHUfHEm2sAHn+AdHPwq/MbVwDssVT8C5yf2WGcqiXGg== + dependencies: + "@react-spring/animated" "~9.2.0" + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/konva@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/konva/-/konva-9.2.4.tgz#e467b24b3b110ba496526c9001439ce561641e0d" + integrity sha512-19anDOIkfjcydDTfGgVIuZ3lruZxKubYGs9oHCswaP8SRLj7c1kkopJHUr/S4LXGxiIdqdF0XucWm0iTEPEq4w== + dependencies: + "@react-spring/animated" "~9.2.0" + "@react-spring/core" "~9.2.0" + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/native@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/native/-/native-9.2.4.tgz#0fd335a44c05023f5428df444d8f1aa3da7abfc9" + integrity sha512-xKJWKh5qOhSclpL3iuGwJRLoZzTNvlBEnIrMs8yh8xvX6z9Lmnu4uGu5DpfrnM1GzBvRoktoCoLEx/VcEYFSng== + dependencies: + "@react-spring/animated" "~9.2.0" + "@react-spring/core" "~9.2.0" + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/rafz@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/rafz/-/rafz-9.2.4.tgz#44793e9adc14dd0dcd1573d094368af11a89d73a" + integrity sha512-SOKf9eue+vAX+DGo7kWYNl9i9J3gPUlQjifIcV9Bzw9h3i30wPOOP0TjS7iMG/kLp2cdHQYDNFte6nt23VAZkQ== + +"@react-spring/shared@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/shared/-/shared-9.2.4.tgz#f9cc66ac5308a77293330a18518e34121f4008c1" + integrity sha512-ZEr4l2BxmyFRUvRA2VCkPfCJii4E7cGkwbjmTBx1EmcGrOnde/V2eF5dxqCTY3k35QuCegkrWe0coRJVkh8q2Q== + dependencies: + "@react-spring/rafz" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/three@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/three/-/three-9.2.4.tgz#849c97658a6e1410b6f823ad21e2ee33feada820" + integrity sha512-ljFig7XW099VWwRPKPUf+4yYLivp/sSWXN3oO5SJOF/9BSoV1quS/9chZ5Myl5J14od3CsHf89Tv4FdlX5kHlA== + dependencies: + "@react-spring/animated" "~9.2.0" + "@react-spring/core" "~9.2.0" + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/types@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/types/-/types-9.2.4.tgz#2365ce9d761f548a9adcb2cd68714bf26765a5de" + integrity sha512-zHUXrWO8nweUN/ISjrjqU7GgXXvoEbFca1CgiE0TY0H/dqJb3l+Rhx8ecPVNYimzFg3ZZ1/T0egpLop8SOv4aA== + +"@react-spring/web@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/web/-/web-9.2.4.tgz#c6d5464a954bfd0d7bc90117050f796a95ebfa08" + integrity sha512-vtPvOalLFvuju/MDBtoSnCyt0xXSL6Amyv82fljOuWPl1yGd4M1WteijnYL9Zlriljl0a3oXcPunAVYTD9dbDQ== + dependencies: + "@react-spring/animated" "~9.2.0" + "@react-spring/core" "~9.2.0" + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + +"@react-spring/zdog@~9.2.0": + version "9.2.4" + resolved "https://registry.yarnpkg.com/@react-spring/zdog/-/zdog-9.2.4.tgz#db1d1924fe9920e917d889c4d3bb138bd0885cf1" + integrity sha512-rv7ptedS37SHr6yuCbRkUErAzAhebdgt8f4KUtZWzseC+7qLNkaZWf+uujgsb881qAuX9b9yz8rre9UKeYepgw== + dependencies: + "@react-spring/animated" "~9.2.0" + "@react-spring/core" "~9.2.0" + "@react-spring/shared" "~9.2.0" + "@react-spring/types" "~9.2.0" + "@samverschueren/stream-to-observable@^0.3.0": version "0.3.1" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.1.tgz#a21117b19ee9be70c379ec1877537ef2e1c63301" @@ -2269,6 +2354,11 @@ semver "^7.3.2" tsutils "^3.17.1" +"@use-it/event-listener@^0.1.2": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@use-it/event-listener/-/event-listener-0.1.6.tgz#5776274fec72f3f25af9ead1898e7f45bc435812" + integrity sha512-e6V7vbU8xpuqy4GZkTLExHffOFgxmGHo3kNWnlhzM/zcX2v+idbD/HaJ9sKdQMgTh+L7MIhdRDXGX3SdAViZzA== + "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" @@ -7218,6 +7308,14 @@ gatsby-plugin-typescript@^2.12.1, gatsby-plugin-typescript@^2.4.19: "@babel/runtime" "^7.12.5" babel-plugin-remove-graphql-queries "^2.16.1" +gatsby-plugin-use-dark-mode@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/gatsby-plugin-use-dark-mode/-/gatsby-plugin-use-dark-mode-1.3.0.tgz#995ab84e3b867fe94797b7b1c081e90c7c12c8dc" + integrity sha512-AdUlgzZV9kzTdff2LUEfeyWhQhD45qXFVat6jcAW9EeZXS2266GUiz1ihbX8rzJ32vDRJocJHCsxp5ee9w3M5A== + dependencies: + prop-types "^15.7.2" + terser "^4.0.0" + gatsby-plugin-utils@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/gatsby-plugin-utils/-/gatsby-plugin-utils-0.9.0.tgz#64b35a0faaabad5b5c99ee8951a9c08cd64be289" @@ -13036,6 +13134,25 @@ react-side-effect@^1.1.0: dependencies: shallowequal "^1.0.1" +react-spring@^9.0.0-rc.3: + version "9.2.4" + resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-9.2.4.tgz#9d89b0321664d594f957dca9459b13d94b3dfa39" + integrity sha512-bMjbyTW0ZGd+/h9cjtohLqCwOGqX2OuaTvalOVfLCGmhzEg/u3GgopI3LAm4UD2Br3MNdVdGgNVoESg4MGqKFQ== + dependencies: + "@react-spring/core" "~9.2.0" + "@react-spring/konva" "~9.2.0" + "@react-spring/native" "~9.2.0" + "@react-spring/three" "~9.2.0" + "@react-spring/web" "~9.2.0" + "@react-spring/zdog" "~9.2.0" + +react-toggle-dark-mode@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/react-toggle-dark-mode/-/react-toggle-dark-mode-1.0.4.tgz#196defb8ed5fa7623241048d46104fa24d98e214" + integrity sha512-MREeRur1XGzwyDZZAvPFg01wL9ljR1Dugubc3s/i2bMlLIKaWPfQgx5JbomZfLAxa6OXYDbozJa0e+v39GawmA== + dependencies: + react-spring "^9.0.0-rc.3" + react@^16.12.0: version "16.14.0" resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d" @@ -14991,7 +15108,7 @@ terser-webpack-plugin@^2.3.8: terser "^4.6.12" webpack-sources "^1.4.3" -terser@^4.1.2, terser@^4.6.12: +terser@^4.0.0, terser@^4.1.2, terser@^4.6.12: version "4.8.0" resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== @@ -15826,6 +15943,21 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +use-dark-mode@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/use-dark-mode/-/use-dark-mode-2.3.1.tgz#d506349c7b7e09e9977cb8a6ab4470896aa3779a" + integrity sha512-hmcdJR96tTustRQdaQwe6jMrZHnmPqXBxgy4jaQ4gsfhwajsCpjECuq9prgDe9XxMx/f9r96o2/md6O4Lwhwjg== + dependencies: + "@use-it/event-listener" "^0.1.2" + use-persisted-state "^0.3.0" + +use-persisted-state@^0.3.0: + version "0.3.3" + resolved "https://registry.yarnpkg.com/use-persisted-state/-/use-persisted-state-0.3.3.tgz#5e0f2236967cec7c34de33abc07ae6818e7c7451" + integrity sha512-pCNlvYC8+XjRxwnIut4teGC9f2p9aD88R8OGseQGZa2dvqG/h1vEGk1vRE1IZG0Vf161UDpn+NlW4+UGubQflQ== + dependencies: + "@use-it/event-listener" "^0.1.2" + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"