Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@ GEM
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x64-mingw-ucrt)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x64-mingw-ucrt)
ffi (1.17.4-x86_64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
forwardable-extended (2.6.0)
google-protobuf (4.27.5-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.27.5-x64-mingw-ucrt)
bigdecimal
rake (>= 13)
google-protobuf (4.27.5-x86_64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.27.5-x86_64-linux)
google-protobuf (4.33.6)
bigdecimal
rake (>= 13)
http_parser.rb (0.8.0)
Expand Down
6 changes: 6 additions & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<a href="https://railsgirls.tumblr.com/">Blog</a>
<a href="/guide">Organizers</a>
<a href="/">Guides</a>
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle Dark Mode">
<span class="theme-toggle-icon"></span>
</button>
</nav>
</div>

Expand All @@ -24,6 +27,9 @@
</a>

<a class="brand" href="/">Rails Girls Guides</a>
<button id="theme-toggle-mobile" class="theme-toggle" aria-label="Toggle Dark Mode">
<span class="theme-toggle-icon"></span>
</button>

<div class="nav-collapse navbar-responsive-collapse navbar-collapse" id='navbar-list' style='height: 0;'>
<ul class="nav">
Expand Down
8 changes: 8 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<script>
(function() {
const savedTheme = localStorage.getItem('theme');
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
const theme = savedTheme || systemTheme;
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
{% capture page_title_capture %}
{% if page.title == nil %}
{{ site.site_title }}
Expand Down
127 changes: 99 additions & 28 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
html {
:root {
--highlight: #e0330c;
background: #f4f4f4;
--bg-primary: #ffffff;
--bg-secondary: #f4f4f4;
--text-primary: #333333;
--text-secondary: #666666;
--header-bg: #d3360b;
--header-text: #ffffff;
--border-color: #dddddd;
--kbd-bg: #f7f7f7;
--kbd-border: #cccccc;
--kbd-text: #333333;
--nav-hover: #f6e58d;
--guide-notice-bg: #fef8ea;
}

[data-theme="dark"] {
--bg-primary: #1a1a1a;
--bg-secondary: #121212;
--text-primary: #e0e0e0;
--text-secondary: #b0b0b0;
--header-bg: #802107;
--border-color: #333333;
--kbd-bg: #2d2d2d;
--kbd-border: #444444;
--kbd-text: #e0e0e0;
--nav-hover: #ffd700;
--guide-notice-bg: #2d2d00;
}

html {
background: var(--bg-secondary);
transition: background 0.3s ease;
}

body {
margin: 0px;
background: #fff;
color: #333;
background: var(--bg-primary);
color: var(--text-primary);
text-rendering: optimizeLegibility;
font-size: 15px;
line-height: 1.6;
transition: background 0.3s ease, color 0.3s ease;
}

h1 {
Expand All @@ -30,7 +61,7 @@ h2 em {
margin-left: -1.5em;
font-style: normal;
font-weight: bold;
color: #ccc;
color: var(--text-secondary);
}

h3 {
Expand Down Expand Up @@ -66,7 +97,7 @@ a:hover {
}

hr {
border-top-color: #ddd;
border-top: 1px solid var(--border-color);
margin: 2em 0;
}

Expand All @@ -76,13 +107,14 @@ table {

header {
min-height: 60px;
color: #fff;
color: var(--header-text);
padding-top: 20px;
background: #d3360b;
background: var(--header-bg);
position: sticky;
top: 0;
overflow: hidden;
z-index: 1;
z-index: 100;
transition: background 0.3s ease;
}

header .container .visible-desktop {
Expand All @@ -100,7 +132,7 @@ nav {

nav a,
nav a:focus {
color: #fff;
color: var(--header-text);
text-decoration: none;
font-weight: 300;
font-size: 20px;
Expand All @@ -127,17 +159,18 @@ nav a:hover {
}

footer {
color: #666;
color: var(--text-secondary);
overflow: hidden;
width: 100%;
padding: 40px 0;
background: #f4f4f4;
background: var(--bg-secondary);
line-height: 1.5;
text-align: center;
transition: background 0.3s ease;
}
footer a {
color: #111;
border-color: #111;
color: var(--text-primary);
border-color: var(--text-primary);
}
footer p:last-child {
margin-bottom: 0;
Expand All @@ -161,7 +194,7 @@ footer p:last-child {
min-height: 84px;
}
.guides-list li:not(:last-child) {
border-bottom: 1px solid #ddd;
border-bottom: 1px solid var(--border-color);
}
.guides-list h3 {
margin: 0;
Expand All @@ -188,7 +221,7 @@ footer p:last-child {
font-weight: bold;
text-align: center;

background-color: #d0d0d0;
background-color: var(--border-color);
border-radius: 70px;
transition: 0.1s background-color ease-in;
-webkit-transition: 0.1s background-color ease-in;
Expand All @@ -208,7 +241,7 @@ footer p:last-child {
}
a:hover .guide-icon,
.guide-icon:hover {
background-color: #d3360b;
background-color: var(--header-bg);
transition: 0.1s background-color ease-in;
-webkit-transition: 0.1s background-color ease-in;
-moz-transition: 0.1s background-color ease-in;
Expand Down Expand Up @@ -373,7 +406,7 @@ i.icon-small-browser {
margin-bottom: 20px;
padding: 2px 10px;

border: 2px solid #ddd;
border: 2px solid var(--border-color);
border-radius: 10px;
}
.os-specific.big .picker-options a.active,
Expand All @@ -395,18 +428,18 @@ i.icon-small-browser {

kbd {
padding: 0.1em 0.6em;
border: 1px solid #ccc;
border: 1px solid var(--kbd-border);
font-size: 11px;
font-family: Arial, Helvetica, sans-serif;
background-color: #f7f7f7;
color: #333;
background-color: var(--kbd-bg);
color: var(--kbd-text);
-moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
border-radius: 3px;
display: inline-block;
margin: 0 0.1em;
text-shadow: 0 1px 0 #fff;
text-shadow: none;
line-height: 1.5em;
white-space: nowrap;
}
Expand Down Expand Up @@ -478,7 +511,7 @@ kbd {
display: block;
width: 18px;
height: 4px;
background-color: #fff;
background-color: var(--header-text);
box-shadow: none;
}

Expand All @@ -493,7 +526,7 @@ kbd {
.navbar .nav > li > a:focus,
.navbar .nav > li > a:hover,
nav a:hover {
color: #f6e58d;
color: var(--nav-hover);
text-decoration: none;
background-color: transparent;
}
Expand All @@ -508,10 +541,10 @@ nav a:hover {
margin-bottom: 0;
}
.guide-notice {
background-color: #fef8ea;
background-color: var(--guide-notice-bg);
}
.help-notice {
background-color: #fef8ea;
background-color: var(--guide-notice-bg);
}
.help-notice:before {
content: "ℹ️";
Expand Down Expand Up @@ -543,15 +576,15 @@ nav a:hover {
font-size: 18px;
border: none;
outline: none;
background-color: red;
background-color: var(--highlight);
color: white;
cursor: pointer;
padding: 14px;
border-radius: 30px;
transition: all .4s;
}
.go-to-top-arrow:hover {
background-color: #555;
background-color: var(--text-primary);
}
.go-to-top-arrow.active{
visibility: visible;
Expand All @@ -570,3 +603,41 @@ nav a:hover {
transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
}

.theme-toggle {
background: none;
border: 1px solid var(--header-text);
color: var(--header-text);
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
margin-left: 15px;
vertical-align: middle;
transition: all 0.2s ease;
}

.theme-toggle:hover {
background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .theme-toggle-icon::before {
content: "☀️";
}

[data-theme="light"] .theme-toggle-icon::before {
content: "🌙";
}

/* Default icon if no theme set yet */
.theme-toggle-icon::before {
content: "🌙";
}

@media (max-width: 980px) {
.theme-toggle {
margin-left: 10px;
float: right;
margin-top: -5px;
}
}
16 changes: 16 additions & 0 deletions js/guides.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,26 @@ function initializeOsSwitchers() {
});
}

function initializeThemeToggle() {
const toggleBtn = $('#theme-toggle');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const toggleBtnMobile = $('#theme-toggle-mobile');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).


function toggleTheme() {
const currentTheme = document.documentElement.getAttribute('data-theme');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

document.documentElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
}

toggleBtn.on('click', toggleTheme);
toggleBtnMobile.on('click', toggleTheme);
}

$(document).ready(function() {
addIcons();
initializeOsSwitchers();
loadOs();
initializeThemeToggle();

var osLabelElement = $(".js-detected-os-label");
if (osLabelElement.length > 0) {
Expand Down