From 29e4cec04edf224c36eb6a2f49a78ce9b67953ae Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Thu, 20 Jun 2024 10:10:53 +0100 Subject: [PATCH 1/8] fix eslint error --- .eslintrc.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 6cb0c35..c5e9a6f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,6 +1,6 @@ module.exports = { root: true, - env: { browser: true, es2020: true }, + env: { browser: true, es2020: true, node: true }, extends: [ "eslint:recommended", "plugin:react/recommended", From 07ff6c06b149546ec7c70a5dec33045cd244d072 Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Thu, 20 Jun 2024 10:11:17 +0100 Subject: [PATCH 2/8] fix import --- src/components/Navbar/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Navbar/index.jsx b/src/components/Navbar/index.jsx index c59364a..8cf38eb 100755 --- a/src/components/Navbar/index.jsx +++ b/src/components/Navbar/index.jsx @@ -6,7 +6,7 @@ import { NavLinks, NavLogo, NavMenu, -} from "./NavbarElements"; +} from "@/components/Navbar/NavbarElements"; import { useEffect, useState } from "react"; import { FaBars } from "react-icons/fa"; import { IconContext } from "react-icons/lib"; From 251aef1876a91af0f08191b308aa271deee35ea4 Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Thu, 20 Jun 2024 10:12:05 +0100 Subject: [PATCH 3/8] fix vite error --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 068a57b..22f6a9d 100755 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "homepage": "https://udlbook.github.io/udlbook", + "type": "module", "scripts": { "dev": "vite", "build": "vite build", From 735947b7289435f9f9458700f3bffb152ef2883e Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Thu, 20 Jun 2024 10:39:17 +0100 Subject: [PATCH 4/8] dynamic rendering for news items --- src/components/HeroSection/index.jsx | 246 +++++++++--------- ....learning.turquoise.jpg => book_cover.jpg} | Bin 2 files changed, 120 insertions(+), 126 deletions(-) rename src/images/{F23.prince.learning.turquoise.jpg => book_cover.jpg} (100%) diff --git a/src/components/HeroSection/index.jsx b/src/components/HeroSection/index.jsx index 9a9721b..f63cb5b 100755 --- a/src/components/HeroSection/index.jsx +++ b/src/components/HeroSection/index.jsx @@ -18,10 +18,9 @@ import { Img, UDLLink, } from "@/components/HeroSection/HeroElements"; -import img from "@/images/F23.prince.learning.turquoise.jpg"; +import img from "@/images/book_cover.jpg"; -export default function HeroSection() { - const citation = ` +const citation = ` @book{prince2023understanding, author = "Simon J.D. Prince", title = "Understanding Deep Learning", @@ -31,6 +30,116 @@ export default function HeroSection() { } `; +const news = [ + { + date: "05/22/24", + content: ( + + New{" "} + + blog + {" "} + about the applications of the neural tangent kernel. + + ), + }, + { + date: "05/10/24", + content: ( + + Positive{" "} + + review + {" "} + in Nature Machine Intelligence. + + ), + }, + { + date: "03/12/24", + content: Book now available again., + }, + { + date: "02/21/24", + content: ( + + New blog about the{" "} + + Neural Tangent Kernel + + . + + ), + }, + { + date: "02/15/24", + content: ( + + First printing of book has sold out in most places. Second printing available + mid-March. + + ), + }, + { + date: "01/29/24", + content: ( + + New blog about{" "} + + gradient flow + {" "} + published. + + ), + }, + { + date: "12/26/23", + content: ( + + Machine Learning Street Talk{" "} + podcast discussing + book. + + ), + }, + { + date: "12/19/23", + content: ( + + Deeper Insights{" "} + + podcast + {" "} + discussing book. + + ), + }, + { + date: "12/06/23", + content: ( + + + Interview + {" "} + with Borealis AI. + + ), + }, + { + date: "12/05/23", + content: ( + + Book released by{" "} + + The MIT Press + + . + + ), + }, +]; + +export default function HeroSection() { return ( @@ -38,132 +147,17 @@ export default function HeroSection() { RECENT NEWS: - - 05/22/24 - - {" "} - New{" "} - - {" "} - blog{" "} - {" "} - about the applications of the neural tangent kernel. - - - - - 05/10/24 - - {" "} - Positive{" "} - - review - {" "} - in Nature Machine Intelligence. - - - - {/* - 03/12/24 - - {" "} - Book now available again. - - - - 02/21/24 - - New blog about the{" "} - - Neural Tangent Kernel. - - - Book now available again. - */} - - - 02/21/24 - - New blog about the{" "} - - Neural Tangent Kernel - - . - - - {/* - 02/15/24 - - {" "} - First printing of book has sold out in most places. Second - printing available mid-March. - - - First printing of book has sold out in most places. Second printing available mid-March. - */} - - - 01/29/24 - - {" "} - New blog about{" "} - - {" "} - gradient flow - {" "} - published. - - - - 12/26/23 - - {" "} - Machine Learning Street Talk{" "} - - {" "} - podcast{" "} - {" "} - discussing book. - - - - 12/19/23 - - Deeper Insights{" "} - - podcast - {" "} - discussing book. - - - - 12/06/23 - - {" "} - - Interview - {" "} - with Borealis AI. - - - - 12/05/23 - - {" "} - Book released by{" "} - - The MIT Press - - . - - + {news.map((item, index) => ( + + {item.date} + {item.content} + + ))} CITATION:
-                                
-                                    <>{citation}
-                                
+                                {citation}
                             
@@ -177,7 +171,7 @@ export default function HeroSection() {
- UDL Book + Book Cover Download full pdf (27 May 2024) diff --git a/src/images/F23.prince.learning.turquoise.jpg b/src/images/book_cover.jpg similarity index 100% rename from src/images/F23.prince.learning.turquoise.jpg rename to src/images/book_cover.jpg From 267d6ccb7f064c786089fdf230d849e68db40533 Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Thu, 20 Jun 2024 10:43:35 +0100 Subject: [PATCH 5/8] remove book selling news --- src/components/HeroSection/index.jsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/HeroSection/index.jsx b/src/components/HeroSection/index.jsx index f63cb5b..1bdba5b 100755 --- a/src/components/HeroSection/index.jsx +++ b/src/components/HeroSection/index.jsx @@ -55,10 +55,10 @@ const news = [ ), }, - { - date: "03/12/24", - content: Book now available again., - }, + // { + // date: "03/12/24", + // content: Book now available again., + // }, { date: "02/21/24", content: ( @@ -71,15 +71,15 @@ const news = [ ), }, - { - date: "02/15/24", - content: ( - - First printing of book has sold out in most places. Second printing available - mid-March. - - ), - }, + // { + // date: "02/15/24", + // content: ( + // + // First printing of book has sold out in most places. Second printing available + // mid-March. + // + // ), + // }, { date: "01/29/24", content: ( From ca6e4b29ac7170936aa2afb7703e64376933e78f Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Fri, 21 Jun 2024 10:17:03 +0100 Subject: [PATCH 6/8] simple show more news working --- src/components/HeroSection/HeroElements.jsx | 18 ++++++++++++++++++ src/components/HeroSection/index.jsx | 13 ++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/components/HeroSection/HeroElements.jsx b/src/components/HeroSection/HeroElements.jsx index eeabca0..cf48e2f 100755 --- a/src/components/HeroSection/HeroElements.jsx +++ b/src/components/HeroSection/HeroElements.jsx @@ -274,3 +274,21 @@ export const HeroFollowBlock = styled.div` font-size: 14px; } `; + +export const HeroNewsMoreButton = styled.button` + background: #fff; + color: #000; + font-size: 16px; + padding: 10px 24px; + border: none; + border-radius: 4px; + cursor: pointer; + margin-top: 20px; + margin-bottom: 20px; + align-self: center; + + &:hover { + background: #000; + color: #fff; + } +`; diff --git a/src/components/HeroSection/index.jsx b/src/components/HeroSection/index.jsx index 1bdba5b..cdb7dfa 100755 --- a/src/components/HeroSection/index.jsx +++ b/src/components/HeroSection/index.jsx @@ -13,12 +13,14 @@ import { HeroNewsItem, HeroNewsItemContent, HeroNewsItemDate, + HeroNewsMoreButton, HeroNewsTitle, HeroRow, Img, UDLLink, } from "@/components/HeroSection/HeroElements"; import img from "@/images/book_cover.jpg"; +import { useState } from "react"; const citation = ` @book{prince2023understanding, @@ -140,6 +142,12 @@ const news = [ ]; export default function HeroSection() { + const [showMoreNews, setShowMoreNews] = useState(false); + + const toggleShowMore = () => { + setShowMoreNews((p) => !p); + }; + return ( @@ -147,12 +155,15 @@ export default function HeroSection() { RECENT NEWS: - {news.map((item, index) => ( + {(showMoreNews ? news : news.slice(0, 7)).map((item, index) => ( {item.date} {item.content} ))} + + {showMoreNews ? "Show less" : "Show more"} + CITATION: From 43b8fa368518ac704d526c1436cf530e5bc5e4ca Mon Sep 17 00:00:00 2001 From: Tom Heaton Date: Fri, 21 Jun 2024 10:19:07 +0100 Subject: [PATCH 7/8] fix pdf download texts --- src/components/HeroSection/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/HeroSection/index.jsx b/src/components/HeroSection/index.jsx index cdb7dfa..8ca661e 100755 --- a/src/components/HeroSection/index.jsx +++ b/src/components/HeroSection/index.jsx @@ -185,8 +185,9 @@ export default function HeroSection() { Book Cover - Download full pdf (27 May 2024) + Download full PDF (27 May 2024) +
Date: Fri, 21 Jun 2024 10:21:11 +0100 Subject: [PATCH 8/8] cleanup some state and functions --- src/components/Footer/index.jsx | 4 ++-- src/components/Navbar/index.jsx | 10 +++------- src/pages/index.jsx | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsx index 461ae54..3507b27 100755 --- a/src/components/Footer/index.jsx +++ b/src/components/Footer/index.jsx @@ -33,7 +33,7 @@ const socials = [ ]; export default function Footer() { - const toggleHome = () => { + const scrollToHome = () => { scroll.scrollToTop(); }; @@ -43,7 +43,7 @@ export default function Footer() { - + Understanding Deep Learning diff --git a/src/components/Navbar/index.jsx b/src/components/Navbar/index.jsx index 8cf38eb..394f80c 100755 --- a/src/components/Navbar/index.jsx +++ b/src/components/Navbar/index.jsx @@ -17,11 +17,7 @@ export default function Navbar({ toggle }) { useEffect(() => { const changeNav = () => { - if (window.scrollY >= 80) { - setScrollNav(true); - } else { - setScrollNav(false); - } + setScrollNav(window.scrollY >= 80); }; window.addEventListener("scroll", changeNav); @@ -31,7 +27,7 @@ export default function Navbar({ toggle }) { }; }, []); - const toggleHome = () => { + const scrollToHome = () => { scroll.scrollToTop(); }; @@ -40,7 +36,7 @@ export default function Navbar({ toggle }) {