Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka committed Oct 18, 2024
1 parent a48c551 commit c604a29
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 51 deletions.
16 changes: 13 additions & 3 deletions components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Icon: FC<Props> = ({
className = "",
viewBox = DEFAULT_VIEW_BOX,
width = "45",
height = "45"
height = "45",
}) => (
<span className={`icon ${className}`}>
<svg
Expand Down Expand Up @@ -73,7 +73,12 @@ export function DiscordIcon({ className = "" }) {

export function LightThemeIcon({ className = "" }) {
return (
<Icon className={className} width={"24"} height={"24"} viewBox={"0 0 16 16"}>
<Icon
className={className}
width={"24"}
height={"24"}
viewBox={"0 0 16 16"}
>
<path
fill="#ffffff"
d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"
Expand All @@ -84,7 +89,12 @@ export function LightThemeIcon({ className = "" }) {

export function DarkThemeIcon({ className = "" }) {
return (
<Icon className={className} width={"24"} height={"24"} viewBox={"0 0 24 24"}>
<Icon
className={className}
width={"24"}
height={"24"}
viewBox={"0 0 24 24"}
>
<path
fill="#ffffff"
d="M12.0972 2.53039C12.2913 2.8649 12.2752 3.28136 12.0557 3.5998C11.3898 4.56594 11 5.73595 11 7.00002C11 10.3137 13.6863 13 17 13C18.2641 13 19.4341 12.6102 20.4002 11.9443C20.7187 11.7249 21.1351 11.7087 21.4696 11.9028C21.8041 12.0969 21.9967 12.4665 21.9642 12.8519C21.5313 17.9765 17.236 22 12 22C6.47715 22 2 17.5229 2 12C2 6.76398 6.02351 2.46874 11.1481 2.03585C11.5335 2.0033 11.9031 2.19588 12.0972 2.53039ZM9.42424 4.42352C6.26994 5.49553 4 8.48306 4 12C4 16.4183 7.58172 20 12 20C15.517 20 18.5045 17.7301 19.5765 14.5758C18.7676 14.8508 17.9008 15 17 15C12.5817 15 9 11.4183 9 7.00002C9 6.09922 9.1492 5.2324 9.42424 4.42352Z"
Expand Down
2 changes: 1 addition & 1 deletion components/libs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Lib: FC<{ lib: Library }> = ({ lib }) => (
"is-half",
"is-flex",
"tk-lib",
`tk-lib-${lib.id}`
`tk-lib-${lib.id}`,
)}
>
<div className="card">
Expand Down
2 changes: 1 addition & 1 deletion components/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function Level2({ href, menu }) {
items.unshift(
<li key={menu.key} className={className}>
<a href={menu.href}>{menu.data.subtitle}</a>
</li>
</li>,
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const Layer: FC<{ layer: StackLayer }> = ({ layer }) => (
export default function Stack() {
useEffect(() => {
var stack = document.getElementsByClassName(
"tk-stack-active"
"tk-stack-active",
) as HTMLCollectionOf<HTMLElement>;
var links = document.querySelectorAll(".tk-stack .menu li");
var lines = document.getElementById("tk-stack-lines");
Expand Down
4 changes: 2 additions & 2 deletions components/toggle-theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const ToggleTheme: React.FC = () => {
* Handles theme change
*/
const toggleTheme = () => {
const THEME_KEY = 'data-theme';
const THEME_KEY = "data-theme";

// getting current theme from body element
const currentTheme = document.body.getAttribute(THEME_KEY);

// new theme, opposite to current theme
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
const newTheme = currentTheme === "light" ? "dark" : "light";

// set new theme on body element
document.body.setAttribute(THEME_KEY, newTheme);
Expand Down
6 changes: 3 additions & 3 deletions lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const contentDir = path.join(process.cwd(), "content").replace(/\\/g, "/");

// Merge app level props in with page props
export function withAppProps(
props: { props: Record<PropertyKey, unknown> } = { props: {} }
props: { props: Record<PropertyKey, unknown> } = { props: {} },
) {
const blog = getLastBlog();
delete blog.body;
Expand Down Expand Up @@ -108,7 +108,7 @@ function setPrevNext(page, menu) {
}
},
undefined,
undefined
undefined,
);

return page;
Expand All @@ -117,7 +117,7 @@ function setPrevNext(page, menu) {
// Build a list of paths from the sitemap
function collectPaths(
level: Record<string, { nested?: string[]; href?: string }>,
prefix = ""
prefix = "",
) {
let out = [];

Expand Down
2 changes: 1 addition & 1 deletion lib/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ export const toHTML = async (raw) => {
.use(rehyperBlockquotePlus, rehyperBlockquotePlusOptions)
// @ts-expect-error: unified's plugin type mistakenly selects the Array<void> union variant
.use(rehypeStringify)
.process(raw)
.process(raw),
);
};
66 changes: 37 additions & 29 deletions styles/dark-styles.scss
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
/** COLOR VALUES */
$surface-100: #1B1B1B; // For body background color
$surface-200: #1F1F1F; // For cards, aside, sidebars background color
$surface-100: #1b1b1b; // For body background color
$surface-200: #1f1f1f; // For cards, aside, sidebars background color
$surface-250: #242424;
$surface-300: #2D2D2D; // Navbar - For chips buttons, dropdowns background color
$surface-300: #2d2d2d; // Navbar - For chips buttons, dropdowns background color
$surface-400: #353535; // For sidebars, navbar background color
$surface-500: #3D3D3D; // For modal, dialogs background color
$surface-500: #3d3d3d; // For modal, dialogs background color
$surface-600: #404040; // divider, hr, border
$surface-700: #696969; // For on background texts color | 267 0 41

$light-gray: #D6D6D6; // hover on secondary text
$gray: #A0A0A0; // secondary text
$light-gray: #d6d6d6; // hover on secondary text
$gray: #a0a0a0; // secondary text
$dark-gray: #939393; // code snippet text

$magenta-000: #C63995;
$magenta-100: #DE46A9;
$magenta-200: #E25AB2;
$magenta-300: #E670BD;
$magenta-000: #c63995;
$magenta-100: #de46a9;
$magenta-200: #e25ab2;
$magenta-300: #e670bd;

$pure-white: #ffffff;
$white: #F0F0F0; // text, title
$white: #f0f0f0; // text, title
$red: #e7544c;
$orange: #f5a623;
$black-pink: #211E21;
$purple: #B284EB;
$green: #81C42C;
$yellow: #DDB218;
$blue: #4197E3;
$lightblue: #56A3E6;
$black-pink: #211e21;
$purple: #b284eb;
$green: #81c42c;
$yellow: #ddb218;
$blue: #4197e3;
$lightblue: #56a3e6;

// Each color is associated with a library
$tk-lib-runtime: $magenta-200;
Expand All @@ -37,12 +37,16 @@ $tk-lib-mio: $red;
$tk-lib-tracing: $purple;
$tk-lib-bytes: $blue;


// Per lib styling: [ name, bg-color, color, size, logo-adjust ]
$libs: "tokio" $white $surface-100 3.8rem -60%, "runtime" $tk-lib-runtime $surface-100 2.2rem -22%,
"hyper" $tk-lib-hyper $surface-100 100% -50%, "tonic" $tk-lib-tonic $surface-100 100% -25%,
"tower" $tk-lib-tower $surface-100 100% -52%, "mio" $tk-lib-mio $surface-100 100% -41%,
"tracing" $tk-lib-tracing $surface-100 100% -31%, "bytes" $tk-lib-bytes $surface-100 100% -30%;
$libs:
"tokio" $white $surface-100 3.8rem -60%,
"runtime" $tk-lib-runtime $surface-100 2.2rem -22%,
"hyper" $tk-lib-hyper $surface-100 100% -50%,
"tonic" $tk-lib-tonic $surface-100 100% -25%,
"tower" $tk-lib-tower $surface-100 100% -52%,
"mio" $tk-lib-mio $surface-100 100% -41%,
"tracing" $tk-lib-tracing $surface-100 100% -31%,
"bytes" $tk-lib-bytes $surface-100 100% -30%;

body {
background-color: $surface-100;
Expand All @@ -68,7 +72,8 @@ body {
color: $magenta-200;
}
}
.navbar-brand, .navbar-menu {
.navbar-brand,
.navbar-menu {
background-color: $surface-400;
}
hr {
Expand All @@ -85,7 +90,8 @@ body {
.hero {
&.is-primary {
background-color: $surface-200;
.title, .subtitle {
.title,
.subtitle {
color: $white;
}
}
Expand All @@ -96,14 +102,16 @@ body {
.button:hover {
background-color: $magenta-100;
}
.title, .subtitle {
.title,
.subtitle {
color: $white;
}
}
&.tk-users {
background-color: $surface-100;

.title, .subtitle {
.title,
.subtitle {
color: $white;
}

Expand Down Expand Up @@ -237,7 +245,6 @@ body {
color: $magenta-200;
}
}

}

li.is-active {
Expand Down Expand Up @@ -281,7 +288,7 @@ body {
.tk-markdown {
.is-warning {
background: $black-pink;
color: $light-gray;// $magenta-100;
color: $light-gray; // $magenta-100;

strong,
code {
Expand Down Expand Up @@ -373,7 +380,8 @@ strong {
*
*/

pre, code {
pre,
code {
background-color: $surface-250;
}

Expand Down
26 changes: 16 additions & 10 deletions styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ $tk-lib-tracing: $purple;
$tk-lib-bytes: $blue;

// Per lib styling: [ name, color, size, logo-adjust ]
$libs: "tokio" black 3.8rem -60%, "runtime" $tk-lib-runtime 2.2rem -22%,
"hyper" $tk-lib-hyper 100% -50%, "tonic" $tk-lib-tonic 100% -25%,
"tower" $tk-lib-tower 100% -52%, "mio" $tk-lib-mio 100% -41%,
"tracing" $tk-lib-tracing 100% -31%, "bytes" $tk-lib-bytes 100% -30%;
$libs:
"tokio" black 3.8rem -60%,
"runtime" $tk-lib-runtime 2.2rem -22%,
"hyper" $tk-lib-hyper 100% -50%,
"tonic" $tk-lib-tonic 100% -25%,
"tower" $tk-lib-tower 100% -52%,
"mio" $tk-lib-mio 100% -41%,
"tracing" $tk-lib-tracing 100% -31%,
"bytes" $tk-lib-bytes 100% -30%;

// Bulma color variables
$primary: $cream;
Expand Down Expand Up @@ -127,7 +132,7 @@ a:active {
font-family: inherit;
padding: 0;
-webkit-tap-highlight-color: transparent;

// custom styles
width: 100%;
height: 100%;
Expand All @@ -136,17 +141,17 @@ a:active {
align-items: center;
justify-content: center;
transition: background 200ms;

&:hover {
background-color: darken($dark-gray);
}
}

body[data-theme=dark] &__icon--light {
body[data-theme="dark"] &__icon--light {
display: none;
}

body:not([data-theme=dark]) &__icon--dark {
body:not([data-theme="dark"]) &__icon--dark {
display: none;
}
}
Expand Down Expand Up @@ -222,7 +227,8 @@ a:active {
margin-top: 0.5rem;
}
// Resetting reduced whitespace to normal
&.navbar-text, &.navbar-icon {
&.navbar-text,
&.navbar-icon {
padding: 0 1.5rem;
}
}
Expand Down Expand Up @@ -1123,7 +1129,7 @@ Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine
//#region Dark Theme Styles

// Applying dark theme when body has dark atribute, not matter the theme preference
body[data-theme=dark] {
body[data-theme="dark"] {
@import "./dark-styles.scss";
}

Expand Down

0 comments on commit c604a29

Please sign in to comment.