diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..1681c04 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,17 @@ + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://tymur999srv:5432/postgres + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/src/articles/ArticlesList.tsx b/src/articles/ArticlesList.tsx index 4ec42bc..0038220 100644 --- a/src/articles/ArticlesList.tsx +++ b/src/articles/ArticlesList.tsx @@ -1,17 +1,9 @@ -import {Article} from "./articles"; -import allBlack from "../img/IMG_3095.jpg"; -import {lazy, useState} from "react"; +import {Article, ARTICLES} from "./articles"; +import {useState} from "react"; import "./list.sass"; import {ReactComponent as BoxSvg} from "../img/blog-box.svg"; import {Reader} from "./Reader"; -const ARTICLES: Article[] = [{ - name: "My high school experience", - description: "My first program, winning two senior superlatives, and why (and how) I chose Georgia Tech", - thumbnail: allBlack, - published: new Date(), - article: lazy(() => import("../about/About.mdx")) -}]; export function ArticlesList() { const [reading, setReading] = useState
(null); @@ -21,14 +13,12 @@ export function ArticlesList() {
{ ARTICLES.map(a => - + ) } - { - reading && - }
+ } diff --git a/src/articles/Reader.tsx b/src/articles/Reader.tsx index 45be439..0c4f36c 100644 --- a/src/articles/Reader.tsx +++ b/src/articles/Reader.tsx @@ -1,5 +1,41 @@ import {Article} from "./articles"; +import {motion} from "framer-motion"; +import {useAnimate} from "motion/react"; +import {TargetAndTransition} from "motion"; +import {useEffect} from "react"; -export function Reader(article: Article) { - return
{article.name}
+type Transition = "open" | "closed"; +const READER : Record = { + closed : { opacity: 0 }, + open : { opacity: 1 } +}; + +type Props = { post: Article | null, setPost: (_: Article | null) => void }; +export function Reader({ post, setPost }: Props) { + const [ scope, animate ]= useAnimate(); + + useEffect(() => { + if(post && scope.current) { + animate(scope.current, READER.open); + } + }, [post, scope]); + + function handleClose() { + animate(scope.current, READER.closed) + .then(() => setPost(null)); + } + + return post ? ( + +
e.stopPropagation()}> + +
+
+ ) : <>; } \ No newline at end of file diff --git a/src/articles/articles.ts b/src/articles/articles.ts index e04d641..255bf33 100644 --- a/src/articles/articles.ts +++ b/src/articles/articles.ts @@ -1,6 +1,7 @@ import {Path} from "../router/router"; import {MDXContent} from "mdx/types"; -import type {LazyExoticComponent} from "react"; +import {lazy, LazyExoticComponent} from "react"; +import allBlack from "../img/IMG_3095.jpg"; export interface Article { name: string, @@ -10,4 +11,14 @@ export interface Article { published: Date, // lazy load article content article: MDXContent | LazyExoticComponent -} \ No newline at end of file +} + +export const ARTICLES: Article[] = [ + { + name: "My high school experience", + description: "My first program, winning two senior superlatives, and why (and how) I chose Georgia Tech", + thumbnail: allBlack, + published: new Date(Date.parse("3/15/2026")), + article: lazy(() => import("./mdx/high-school.mdx")) + } +]; \ No newline at end of file diff --git a/src/articles/list.sass b/src/articles/list.sass index c0480f6..21c1986 100644 --- a/src/articles/list.sass +++ b/src/articles/list.sass @@ -7,7 +7,6 @@ $entry-width: 400px min-height: 100vh button - z-index: 999 display: flex flex-direction: column max-width: $entry-width @@ -53,3 +52,19 @@ $entry-width: 400px flex-direction: column align-items: center flex-wrap: wrap + +.reader + &, > section + position: absolute + top: 50% + left: 50% + transform: translate(-50%, -50%) + + width: 100vw + height: 100vh + background: rgba(0,0,0,0.5) + > section + background: white + color: black + width: 75vw + height: 75vh \ No newline at end of file diff --git a/src/articles/mdx/high-school.mdx b/src/articles/mdx/high-school.mdx new file mode 100644 index 0000000..95a91e3 --- /dev/null +++ b/src/articles/mdx/high-school.mdx @@ -0,0 +1 @@ +# My high school experience \ No newline at end of file