Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.12.0] Minor redesign and new content #88

Merged
merged 2 commits into from Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added assets/jost/Jost-Italic-VariableFont_wght.ttf
Binary file not shown.
Binary file added assets/jost/Jost-VariableFont_wght.ttf
Binary file not shown.
15 changes: 15 additions & 0 deletions assets/jost/index.css
@@ -0,0 +1,15 @@
/* Jost */
@font-face {
font-family: 'Jost';
src: url('./Jost-VariableFont_wght.ttf');
font-weight: 100 1000;
font-style: normal;
font-stretch: 25% 151%;
}
@font-face {
font-family: 'Jost';
src: url('./Jost-Italic-VariableFont_wght.ttf');
font-weight: 100 1000;
font-style: italic;
font-stretch: 25% 151%;
}
Binary file removed assets/roboto/Roboto-Black.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-Bold.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-Italic.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-Light.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-LightItalic.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-Medium.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-Regular.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-Thin.ttf
Binary file not shown.
Binary file removed assets/roboto/Roboto-ThinItalic.ttf
Binary file not shown.
73 changes: 0 additions & 73 deletions assets/roboto/index.css

This file was deleted.

2 changes: 1 addition & 1 deletion components/app/Footer/index.module.css
Expand Up @@ -11,5 +11,5 @@ footer {
color: var(--fg-color-5);
background: none;
font-family: var(--font-family-widget);
font-size: 0.75rem;
font-size: 85%;
}
5 changes: 4 additions & 1 deletion components/app/Footer/index.tsx
@@ -1,11 +1,14 @@
import React from "react";
import Link from "next/link";
import config from "../../../config";

const Footer = () => {
return (
<footer>
<p>
Version {config.version}
<Link href={`/changelog?v=${config.version}`}>
Version {config.version}
</Link>
</p>
<p>
&copy; 2023 Clarence Siew
Expand Down
10 changes: 10 additions & 0 deletions components/app/NavBar/index.module.css
Expand Up @@ -83,6 +83,7 @@ nav ul {
align-items: center;
justify-content: flex-end;
gap: 0;
font-size: 90%;
}
nav li {
height: 100%;
Expand Down Expand Up @@ -111,6 +112,7 @@ nav li a {
border-color: transparent;
font-weight: bold;
text-decoration: none;
text-transform: uppercase;
transition: var(--transition);
}
nav li a:hover {
Expand Down Expand Up @@ -169,6 +171,14 @@ nav.overlay-menu li :is(a, a.active) {
display: none;
}

#desktop-search-bar {
background: none;
border-color: transparent;
}
#desktop-search-bar:focus {
border-color: var(--primary-color);
}

@media (max-width: 1023px) {
header h1 {
display: none;
Expand Down
20 changes: 12 additions & 8 deletions components/app/NavBar/index.tsx
@@ -1,4 +1,4 @@
import React, { ChangeEvent, FocusEvent, KeyboardEvent, useEffect, useRef, useState } from "react";
import React, { ChangeEvent, KeyboardEvent as ReactKeyboardEvent, useEffect, useRef, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/router";
import Fuse from "fuse.js";
Expand Down Expand Up @@ -39,7 +39,7 @@ const NavBar = ({ setShowSearchModal }: { setShowSearchModal: React.Dispatch<Rea
setIsAtTop(rootEl?.scrollTop === 0);
};

const handleSearchKeyDown = (ev: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
const handleSearchKeyDown = (ev: ReactKeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
if (ev.key === "Escape") {
clearSearch();
}
Expand Down Expand Up @@ -67,6 +67,10 @@ const NavBar = ({ setShowSearchModal }: { setShowSearchModal: React.Dispatch<Rea
setSearchResults([]);
};

useEffect(() => {
if (searchResultsRef.current) positionSearchResults();
}, [handleSearch, searchBarRef.current, searchResultsRef.current]);

useEffect(() => {
const rootEl = document.getElementById(config.rootElementId);
rootEl?.addEventListener("scroll", handleScrollEvent);
Expand All @@ -75,12 +79,14 @@ const NavBar = ({ setShowSearchModal }: { setShowSearchModal: React.Dispatch<Rea
clearSearch();
}
});
window.addEventListener("keydown", (ev: KeyboardEvent) => {
if (ev.key === "/") {
ev.preventDefault();
setShowSearchModal(true);
}
});
}, []);

useEffect(() => {
if (searchResultsRef.current) positionSearchResults();
}, [handleSearch, searchBarRef.current, searchResultsRef.current]);

return (
<>
<header className={!isAtTop ? "with-shadow" : ""}>
Expand Down Expand Up @@ -115,11 +121,9 @@ const NavBar = ({ setShowSearchModal }: { setShowSearchModal: React.Dispatch<Rea
name="search-keywords"
placeholder="Search"
forwardedRef={searchBarRef}
style={{ borderRadius: "32px" }}
defaultValue={searchKeywords}
onChange={handleSearch}
onKeyDown={handleSearchKeyDown}
autoFocus
/>
{
!!searchKeywords.length && (
Expand Down
2 changes: 1 addition & 1 deletion components/app/TagList/index.tsx
Expand Up @@ -29,7 +29,7 @@ const TagList = ({ item, hooks }: TagListProps) => {
fontWeight: "bold",
fontSize: "0.9rem",
textTransform: "uppercase"
}}><small><Link href="/tags" onClick={hooks?.onLinkClick}>Tags</Link>: </small></span>{item?.tags?.map((tag) => <Link key={`${item.slug}-tag-${tag}`} href={`/tags?t=${encodeURIComponent(tag)}`} onClick={hooks?.onLinkClick}><Badge>{tag}</Badge></Link>)}
}}><small><Link href="/tags" onClick={hooks?.onLinkClick}>Tags</Link>: </small></span>{item?.tags?.map((tag) => <Badge key={`${item.slug}-tag-${tag}`}><Link href={`/tags?t=${encodeURIComponent(tag)}`} onClick={hooks?.onLinkClick}>{tag}</Link></Badge>)}
</span>
);
};
Expand Down
7 changes: 4 additions & 3 deletions components/ui/Badge/index.module.css
Expand Up @@ -18,12 +18,12 @@
.badge {
width: min-content;
margin: 0;
padding: 0.06125rem 0.325rem;
padding: 0.01rem 0.325rem;
color: var(--badge-fg-color);
background: var(--badge-bg-color);
border: 1px solid var(--badge-border-color);
border-radius: var(--border-radius);
font-size: 70%;
font-size: 80%;
font-weight: 500;
font-family: var(--font-family-widget);
letter-spacing: 0;
Expand All @@ -34,7 +34,8 @@
-moz-user-select: none;
}

:is(a, a:hover, a:active) span.badge {
.badge :is(a, a:hover, a:active) {
color: var(--badge-fg-color);
text-decoration: none;
}

Expand Down
21 changes: 21 additions & 0 deletions components/ui/Breadcrumbs/index.module.css
Expand Up @@ -48,3 +48,24 @@
color: var(--fg-color-1);
font-weight: normal;
}

.breadcrumbs-back-btn {
display: none !important;
}

@media (max-width: 767px) {
.breadcrumbs-back-btn {
display: inline-flex !important;
border-radius: 100% !important;
}

.breadcrumbs {
padding: 1rem;
color: var(--fg-color);
background: none;
}

.breadcrumbs ul {
display: none;
}
}
14 changes: 14 additions & 0 deletions components/ui/Breadcrumbs/index.tsx
@@ -1,5 +1,7 @@
import Link from "next/link";
import React from "react";
import Button from "../Button";
import { MdArrowBack } from "react-icons/md";

type BreadcrumbsProps = {
items: {
Expand All @@ -11,6 +13,18 @@ type BreadcrumbsProps = {
const Breadcrumbs = ({ items }: BreadcrumbsProps) => {
return (
<div className="breadcrumbs">
{
(items.length > 1) && (
<Button
iconOnly
className="breadcrumbs-back-btn"
variant="link"
url={items[items.length - 2].href}
>
<MdArrowBack />
</Button>
)
}
<ul>
{
items.map((i) => {
Expand Down
36 changes: 21 additions & 15 deletions components/ui/Modal/ModalWindow.tsx
Expand Up @@ -16,22 +16,28 @@ const ModalWindow = ({ children, className, classList, style, disabled, title, c
}, []);

return (
<div
className={["modal-window", disabled ? "disabled" : undefined, className, ...classList || []].join(" ")}
style={style}
>
<div className="modal-window-header">
<h2>
{title}
</h2>
<Button onClick={closeWindowCallback} alt="Close" iconOnly>
<MdClose />
</Button>
<>
<Button className="modal-close-btn" onClick={closeWindowCallback} alt="Close" iconOnly>
<MdClose />
</Button>
<div
className={["modal-window", disabled ? "disabled" : undefined, className, ...classList || []].join(" ")}
style={style}
>
{
!!title && (
<div className="modal-window-header">
<h2>
{title}
</h2>
</div>
)
}
<div className="modal-window-body">
{children}
</div>
</div>
<div className="modal-window-body">
{children}
</div>
</div>
</>
);
};

Expand Down