-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from rosenpass/beta
Beta
- Loading branch information
Showing
39 changed files
with
1,164 additions
and
123 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
let codeListings = document.querySelectorAll('.highlight > pre'); | ||
|
||
for (let index = 0; index < codeListings.length; index++) { | ||
const codeSample = codeListings[index].querySelector('code'); | ||
const copyButton = document.createElement('button'); | ||
const buttonAttributes = { | ||
type: 'button', | ||
title: 'Copy to clipboard', | ||
'data-bs-toggle': 'tooltip', | ||
'data-bs-placement': 'top', | ||
'data-bs-container': 'body', | ||
}; | ||
|
||
Object.keys(buttonAttributes).forEach((key) => { | ||
copyButton.setAttribute(key, buttonAttributes[key]); | ||
}); | ||
|
||
copyButton.classList.add( | ||
'fas', | ||
'fa-copy', | ||
'btn', | ||
'btn-sm', | ||
'td-click-to-copy' | ||
); | ||
const tooltip = new bootstrap.Tooltip(copyButton); | ||
|
||
copyButton.onclick = () => { | ||
copyCode(codeSample); | ||
copyButton.setAttribute('data-bs-original-title', 'Copied!'); | ||
tooltip.show(); | ||
}; | ||
|
||
copyButton.onmouseout = () => { | ||
copyButton.setAttribute('data-bs-original-title', 'Copy to clipboard'); | ||
tooltip.hide(); | ||
}; | ||
|
||
const buttonDiv = document.createElement('div'); | ||
buttonDiv.classList.add('click-to-copy'); | ||
buttonDiv.append(copyButton); | ||
codeListings[index].insertBefore(buttonDiv, codeSample); | ||
} | ||
|
||
const copyCode = (codeSample) => { | ||
navigator.clipboard.writeText(codeSample.textContent.trim()); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
// Boxes on the home page and similar: .td-box | ||
|
||
// box-variant creates the main style for a colored section | ||
@mixin box-variant($parent, $color-name, $color-value) { | ||
$text-color: color-contrast($color-value); | ||
$link-color: mix($blue, $text-color, lightness($color-value)); | ||
$link-hover-color: if( | ||
color-contrast($link-color) == $color-contrast-light, | ||
shade-color($link-color, $link-shade-percentage), | ||
tint-color($link-color, $link-shade-percentage) | ||
); | ||
|
||
#{$parent} { | ||
&--#{$color-name} { | ||
color: var(--bs-#{$color-name}--contrast); | ||
background-color: var(--bs-#{$color-name}); | ||
|
||
.td-arrow-down { | ||
&::before { | ||
left: 50%; | ||
margin-left: -30px; | ||
bottom: -25px; | ||
border: { | ||
style: solid; | ||
width: 25px 30px 0 30px; | ||
color: var(--bs-#{$color-name}) transparent transparent transparent; | ||
} | ||
z-index: 3; | ||
position: absolute; | ||
content: ""; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Improve contrast for the links in paragraphs. | ||
@include link-variant( | ||
"#{$parent}--#{$color-name} p > a, #{$parent}--#{$color-name} span > a", | ||
$link-color, | ||
$link-hover-color, | ||
false | ||
); | ||
} | ||
|
||
// Common min-height modifiers used for boxes. | ||
@mixin td-box-height-modifiers($parent) { | ||
#{$parent} { | ||
&--height-min { | ||
min-height: 300px; | ||
} | ||
|
||
&--height-med { | ||
min-height: 400px; | ||
} | ||
|
||
&--height-max { | ||
min-height: 500px; | ||
} | ||
|
||
&--height-full { | ||
min-height: 100vh; | ||
} | ||
|
||
@include media-breakpoint-up(md) { | ||
&--height-min { | ||
min-height: 450px; | ||
} | ||
|
||
&--height-med { | ||
min-height: 500px; | ||
} | ||
|
||
&--height-max { | ||
min-height: 650px; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@include td-box-height-modifiers(".td-box"); | ||
|
||
// Styling for section boxes | ||
.td-box { | ||
.row { | ||
padding-left: 5vw; | ||
padding-right: 5vw; | ||
} | ||
table { | ||
@extend .td-table; | ||
} | ||
} | ||
|
||
// Styling for community page link boxes | ||
|
||
.td-box.linkbox { | ||
padding: 5vh 5vw; | ||
} | ||
|
||
// This allows "painting by numbers" | ||
@for $i from 1 through length($td-box-colors) { | ||
$c: nth($td-box-colors, $i); | ||
$name: $i - 1; | ||
|
||
@include box-variant(".td-box", $name, $c); | ||
} | ||
|
||
// Same as above with all the theme color names. | ||
@each $color, $value in $colors { | ||
@include box-variant(".td-box", $color, $value); | ||
} | ||
|
||
@each $color, $value in $theme-colors { | ||
@include box-variant(".td-box", $color, $value); | ||
} | ||
|
||
@each $color, $value in $grays { | ||
@include box-variant(".td-box", $color, $value); | ||
} | ||
|
||
// Single dark-mode compatibility override for white boxes: | ||
@include color-mode(dark) { | ||
.td-box--white { | ||
color: var(--bs-body-color); | ||
background-color: var(--bs-body-bg); | ||
p > a, span > a { | ||
color: var(--bs-link-color); | ||
&:focus, | ||
&:hover { | ||
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1)); | ||
} | ||
} | ||
.td-arrow-down::before { | ||
border-color: var(--bs-body-bg) transparent transparent transparent; | ||
} | ||
} | ||
.td-box--light:not(.lead-block) { | ||
color: var(--bs-body-color); | ||
background-color: var(--bs-secondary-bg); | ||
p > a, span > a { | ||
color: var(--bs-link-color); | ||
&:focus, | ||
&:hover { | ||
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1)); | ||
} | ||
} | ||
.td-arrow-down::before { | ||
border-color: var(--bs-secondary-bg) transparent transparent transparent; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import 'td/code-dark' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.