Basic styling of the site using some obsidian css

This commit is contained in:
Tuan Cao 2022-03-17 15:42:57 +07:00
parent b4a9546546
commit 19fedf5e6d
3 changed files with 134 additions and 38 deletions

View File

@ -1,31 +1,32 @@
import Head from 'next/head' import Head from 'next/head'
export const siteTitle = 'Digital Backroom - An Internet Archive' export const siteTitle = 'Digital Backroom - An Internet Archive'
export default function Layout({ children, home }) { export default function Layout({children, home}) {
return ( return (
<div > <div>
<Head> <Head>
<meta <link rel="preconnect" href="https://fonts.googleapis.com"/>
name="description" <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin/>
content="A Digital Backroom of Can Burak Sofyalioglu" <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800;900&display=swap"
/> rel="stylesheet"/>
<meta <meta
property="og:image" name="description"
content={`https://og-image.now.sh/${encodeURI( content="A Digital Backroom of Can Burak Sofyalioglu"
siteTitle />
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`} <meta
/> property="og:image"
<meta name="og:title" content={siteTitle} /> content={`https://og-image.now.sh/${encodeURI(
<meta name="twitter:card" content="summary_large_image" /> siteTitle
</Head> )}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
/>
<meta name="og:title" content={siteTitle}/>
<meta name="twitter:card" content="summary_large_image"/>
</Head>
<main>{children}</main> <main className="markdown-rendered theme-light">{children}</main>
</div>
<footer> )
Created by <a href="https://www.cbsofyalioglu.com/" title="Personal blog about design and development">cbsofyalioglu</a>
</footer>
</div>
)
} }

View File

@ -1,27 +1,27 @@
import Head from "next/head"; import Head from "next/head";
import { useRouter } from 'next/router' import {useRouter} from 'next/router'
import { useEffect,useRef } from "react"; import {useEffect, useRef} from "react";
import Layout, { siteTitle } from "../components/layout"; import Layout, {siteTitle} from "../components/layout";
import { getSinglePost, getGraphData } from "../lib/post"; import {getSinglePost, getGraphData} from "../lib/post";
import { Network } from "../components/graph"; import {Network} from "../components/graph";
export default function Home({ content, graphdata, filenames, ...props }) { export default function Home({content, graphdata, filenames, ...props}) {
//console.log("Index Page Props: ", content /* backlinks, filenames*/) //console.log("Index Page Props: ", content /* backlinks, filenames*/)
const ref = useRef(null); const ref = useRef(null);
const router = useRouter() const router = useRouter()
const routeQuery = router.query.id const routeQuery = router.query.id
const routeHandler = (r) => router.push(r) const routeHandler = (r) => router.push(r)
useEffect(() => { useEffect(() => {
if (ref && ref.current){ if (ref && ref.current) {
const G = Network({ const G = Network({
el:ref.current, el: ref.current,
graphdata, graphdata,
current:"index", current: "index",
routeQuery, routeQuery,
routeHandler, routeHandler,
allNodes:false // If true then shows every markdown file as node allNodes: false // If true then shows every markdown file as node
}) })
} }
}, []) }, [])
@ -29,8 +29,14 @@ export default function Home({ content, graphdata, filenames, ...props }) {
return ( return (
<Layout home> <Layout home>
<Head>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin/>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800;900&display=swap"
rel="stylesheet"/>
</Head>
<section> <section>
<div dangerouslySetInnerHTML={{__html: content.data}} /> <div dangerouslySetInnerHTML={{__html: content.data}}/>
</section> </section>
</Layout> </Layout>
); );
@ -42,8 +48,8 @@ export function getStaticProps() {
const graphdata = getGraphData(); const graphdata = getGraphData();
return { return {
props: { props: {
content:contentData, content: contentData,
graphdata:graphdata, graphdata: graphdata,
}, },
}; };
} }

View File

@ -0,0 +1,89 @@
a {
color: var(--text-accent);
outline: none;
}
a:hover {
color: var(--text-accent-hover);
}
.markdown-rendered {
font-size: 18px;
line-height: 1.6em;
width: 740px;
background-color: var(--background-primary);
color: var(--text-normal);
font-family:var(--default-font);
margin: auto;
padding: 20px;
}
:root {
--default-font: 'Inter', sans-serif;
}
.theme-light {
--background-primary: rgba(222, 222, 222, 0.1);
--background-primary-alt: #f5f6f8;
--background-secondary: #f2f3f5;
--background-secondary-alt: #e3e5e8;
--background-modifier-border: #ddd;
--background-modifier-form-field: #fff;
--background-modifier-form-field-highlighted: #fff;
--background-modifier-box-shadow: rgba(0, 0, 0, 0.1);
--background-modifier-success: #A4E7C3;
--background-modifier-error: #990000;
--background-modifier-error-rgb: 230, 135, 135;
--background-modifier-error-hover: #bb0000;
--background-modifier-cover: rgba(0, 0, 0, 0.8);
--text-accent: #705dcf;
--text-accent-hover: #7a6ae6;
--text-normal: #2e3338;
--text-muted: #888888;
--text-muted-rgb: 136, 136, 136;
--text-faint: #999999;
--text-error: #800000;
--text-error-hover: #990000;
--text-highlight-bg: rgba(255, 255, 0, 0.4);
--text-highlight-bg-active: rgba(255, 128, 0, 0.4);
--text-selection: rgb(204 232 255);
--text-on-accent: #f2f2f2;
--interactive-normal: #f2f3f5;
--interactive-hover: #e9e9e9;
--interactive-accent: #7b6cd9;
--interactive-accent-rgb: 123, 108, 217;
--interactive-accent-hover: #8273e6;
--interactive-success: #197300;
--scrollbar-active-thumb-bg: rgba(0, 0, 0, 0.2);
--scrollbar-bg: rgba(0, 0, 0, 0.05);
--scrollbar-thumb-bg: rgba(0, 0, 0, 0.1);
--highlight-mix-blend-mode: darken;
}
.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6 {
margin: 15px 0;
}
.markdown-rendered h1 {
font-size: 2em;
}
.markdown-rendered h2 {
font-size: 1.6em;
}
.markdown-rendered h3 {
font-size: 1.37em;
}
.markdown-rendered h4 {
font-size: 1.25em;
}
.markdown-rendered h5,
.markdown-rendered h6 {
font-size: 1.12em;
}
.markdown-rendered h6 {
color: var(--text-muted);
}