How to build a smoothly animated table of contents (by a bonfire🔥) w/ Bun, Framer Motion, Zustand

devaslife • September 16, 2024
Video Thumbnail
devaslife Logo

devaslife

View Channel

About

I'm an indie app developer based in Osaka, Japan. I'm currently living off of my own product called Inkdrop - a Markdown note-taking app (https://www.inkdrop.app/ ). I would like to publish my videos about: how to build good apps, how to attract users, my hobbies, etc. NOTE: I don't answer any personal questions - Please don't send me emails.

Video Description

▶ Check out my product: Inkdrop - Markdown note-taking app https://www.inkdrop.app/?utm_source=devaslife&utm_medium=youtube&utm_campaign=vlog&utm_content=4g26x6FzuBU ▶ Join the Inkdrop discord server https://docs.inkdrop.app/start-guide/join-discord-server?utm_source=devaslife&utm_medium=youtube&utm_campaign=vlog&utm_content=4g26x6FzuBU ▶ Side notes: https://www.devas.life/how-to-build-a-smoothly-animated-table-of-contents-with-framer-motion-and-kuma-ui/ ▶ Source code https://github.com/craftzdog/smooth-toc-example Info ▶ My equipment http://uses.craftz.dog/ ▶ My dotfiles https://github.com/craftzdog/dotfiles-public ▶ My wallpaper packs are now available🥳 Check out serene imagery from my coding tutorials here: https://www.craftz.dog/wallpapers Follow me online here: ▶ Subscribe to my newsletter https://www.devas.life/ ▶ 𝕏 https://x.com/inkdrop_app ▶ Instagram https://instagram.com/craftzdog ▶ My second channel https://www.youtube.com/@craftzdog 00:00 Intro 01:17 Project overview 05:00 Init project with Bun 06:04 Configure the git repository 06:45 Add required modules 08:11 Change dev and build commands to use Bun 08:40 Configure Prettier 09:35 Replace the default`useState` implementation with Zustand 12:02 Configure Kuma UI 13:57 Add some personal ESLint Preferences 15:11 Add some personal TypeScript preferences 16:30 Rename uppercase filenames 17:27 Configure Vite's resolve alias 18:31 Normalize CSS 19:28 Remove the default styles 20:13 Add the color palette tokens 21:11 Add basic styles 23:32 Create a Container component 26:58 Create a MainContent component 30:58 Add an example content 32:56 Moving to the next location, and start a bonfire 36:49 Implement a Markdown renderer 41:07 Add a content store 44:45 Render Markdown content 46:30 Add a page title 49:55 Style Markdown content 53:40 Extract headings from the mdast tree 57:46 Add firewood 58:07 toc store 59:59 Morning coffee 01:00:31 Fix import bug 01:02:10 Register headings 01:04:34 Add custom heading component 01:09:44 Get slugs to work 01:12:03 Preserve heading refs 01:13:00 Sidebar 01:15:57 Markdown outline view 01:24:17 Fix the outline left border 01:25:02 Store outline item refs in the toc store 01:27:40 Register refs to the store 01:29:25 Highlight active section 01:32:53 Detect visible headings 01:40:05 Animate the active section highlighting bar 01:43:37 It works! Yayy Credits: ▶ BGM - Epidemic Sound https://www.epidemicsound.com/referral/p96aa8/ #CodeInNature #ReactJS #ASMR

You May Also Like

Upgrade Today: iPhone 14 Must-Haves

AI-recommended products based on this video

Loading...
BASESAILOR iPhone 16 16e Car Charger Adapter 3Pack,USB to USBC Connector Type C Female to A Male Cable Converter for iPhone 15 14 Pro Max Plus,Apple Watch 10,Airpods 4,iPad mini 7,Samsung Galaxy S25

BASESAILOR iPhone 16 16e Car Charger Adapter 3Pack,USB to USBC Connector Type C Female to A Male Cable Converter for iPhone 15 14 Pro Max Plus,Apple Watch 10,Airpods 4,iPad mini 7,Samsung Galaxy S25

(7,876)
$11.99
FREE delivery Sat, Jun 14 on your first order
500+ bought in past month
Loading...
URVNS 240W USB C Car Charger, Super Fast Charging 4-Ports PD3.1 140W/PD3.0 100W PPS 45W QC65W Type-C Car Adapter for MacBook Pro Laptop iPhone 15 14 Max iPad Samsung Galaxy S24/23/22 Pixel etc

URVNS 240W USB C Car Charger, Super Fast Charging 4-Ports PD3.1 140W/PD3.0 100W PPS 45W QC65W Type-C Car Adapter for MacBook Pro Laptop iPhone 15 14 Max iPad Samsung Galaxy S24/23/22 Pixel etc

(114)
$57.36$49.99
Prime$5.48 delivery Mon, Jun 16
Loading...
UGREEN 130W Car Charger USB C Fast Charger PD3.0 QC4.0 PPS Fast Charging Car Adapter with 100W USB C Cable Compatible with Dell XPS, MacBook, iPhone 16 15 14 Pro Max, Galaxy S25 S24 Ultra, iPad Pro

UGREEN 130W Car Charger USB C Fast Charger PD3.0 QC4.0 PPS Fast Charging Car Adapter with 100W USB C Cable Compatible with Dell XPS, MacBook, iPhone 16 15 14 Pro Max, Galaxy S25 S24 Ultra, iPad Pro

(4,725)
$31.99
500+ bought in past month
Loading...
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

(54,882)
$32.25
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month
Loading...
2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

(2,193)
$14.24
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
Magnetic Wireless Charger for iPhone: Fodable 3 in 1 Charging Station for Multiple Apple Devices - Travel Charging Pad Dock for Apple Watch iPhone 16 15 14 13 12 Pro Max Plus & Airpod Global Recycled Standard

Magnetic Wireless Charger for iPhone: Fodable 3 in 1 Charging Station for Multiple Apple Devices - Travel Charging Pad Dock for Apple Watch iPhone 16 15 14 13 12 Pro Max Plus & Airpod Global Recycled Standard

(656)
$49.99
PrimeFREE delivery Sat, Jun 14
100+ bought in past month
Loading...
Magnetic Wireless Charger for iPhone - 3 in 1 Mag-Safe Charging Station for Multiple Devices Apple - Charger Stand Dock for Apple Watch iPhone 16 15 14 13 12 Pro Max Plus Airpods

Magnetic Wireless Charger for iPhone - 3 in 1 Mag-Safe Charging Station for Multiple Devices Apple - Charger Stand Dock for Apple Watch iPhone 16 15 14 13 12 Pro Max Plus Airpods

(750)
$59.99
PrimeFREE delivery Sat, Jun 14
Loading...
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

(5,626)
$17.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
DUEDUE for Samsung Galaxy S25 Plus Case Magnetic Samsung S24 Plus Case Clear Compatible with Magsafe Slim Cover with Stand Ring Shockproof Protective Case for Samsung S25 Plus/S24 Plus 6.7 Inch Clear

DUEDUE for Samsung Galaxy S25 Plus Case Magnetic Samsung S24 Plus Case Clear Compatible with Magsafe Slim Cover with Stand Ring Shockproof Protective Case for Samsung S25 Plus/S24 Plus 6.7 Inch Clear

(38)
$17.99
FREE delivery Sat, Jun 14 on your first order
Loading...
RALEAVO for iPhone 16 Case Compatible with MagSafe Strong Magnetic Phone Case Clear Floral Case for Women Girls Slim Hard Back Protective Case for iPhone 16 6.1"(Clear/Lavender)

RALEAVO for iPhone 16 Case Compatible with MagSafe Strong Magnetic Phone Case Clear Floral Case for Women Girls Slim Hard Back Protective Case for iPhone 16 6.1"(Clear/Lavender)

(872)
$15.99
FREE delivery Sat, Jun 14 on your first order
Loading...
Vihibii for Samsung Galaxy S25 Clear Magnetic Case with Stand, Compatible with MagSafe, [Anti Yellowing] Shockproof & Scratch Proof, Transparent Silm Phone Case for Samsung Galaxy S25 6.2" 2025, Clear

Vihibii for Samsung Galaxy S25 Clear Magnetic Case with Stand, Compatible with MagSafe, [Anti Yellowing] Shockproof & Scratch Proof, Transparent Silm Phone Case for Samsung Galaxy S25 6.2" 2025, Clear

(164)
$21.99$19.17
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
ESR for iPhone 16 Pro Max Case, Compatible with MagSafe, Shockproof Military-Grade Protection, Magnetic Phone Case for iPhone 16 Pro Max, Classic Hybrid Case (HaloLock), Clear

ESR for iPhone 16 Pro Max Case, Compatible with MagSafe, Shockproof Military-Grade Protection, Magnetic Phone Case for iPhone 16 Pro Max, Classic Hybrid Case (HaloLock), Clear

(71,292)
$14.44
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
Wireless Charging Case for AirPods Pro 1st / 2nd Gen with Type-C Charging Port, Compatible with AirPod Pro 2nd Generation Replacement Case, with Blue-Tooth Sync Button, No Earbuds

Wireless Charging Case for AirPods Pro 1st / 2nd Gen with Type-C Charging Port, Compatible with AirPod Pro 2nd Generation Replacement Case, with Blue-Tooth Sync Button, No Earbuds

(15)
$42.98
PrimeFREE delivery Sat, Jun 14
Loading...
Turtle Beach Stealth Ultra High-Performance Wireless Gaming Controller Licensed for Xbox Series X|S, Xbox One, Windows PC & Android – LED Dashboard, Charge Dock, RGB Lighting, 30-Hr Battery, Bluetooth

Turtle Beach Stealth Ultra High-Performance Wireless Gaming Controller Licensed for Xbox Series X|S, Xbox One, Windows PC & Android – LED Dashboard, Charge Dock, RGB Lighting, 30-Hr Battery, Bluetooth

(1,771)
$224.95$199.41
PrimeFREE delivery Sat, Jun 14
Loading...
Spigen Case for Galaxy S25 Case, Rugged Armor MagFit [Fast Wireless Charging] Compatible with MagSafe - Black

Spigen Case for Galaxy S25 Case, Rugged Armor MagFit [Fast Wireless Charging] Compatible with MagSafe - Black

(667)
$25.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
Spigen Case for iPhone 16 Pro Max Case, Rugged Armor [MagFit] Compatible with MagSafe - Matte Black

Spigen Case for iPhone 16 Pro Max Case, Rugged Armor [MagFit] Compatible with MagSafe - Matte Black

(1,422)
$25.99$19.34
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
McKlein McKleinUSA 80454 Lawson Leather Attache Case, Brown, 18 x 13 x 3.5

McKlein McKleinUSA 80454 Lawson Leather Attache Case, Brown, 18 x 13 x 3.5

(158)
$168.49
PrimeFREE delivery Sat, Jun 14
Loading...
iWEOCO Compatible with Samsung S25 Case Wallet Genuine Leather Anti-Theft RFID Blocking Stand Strong Magnetic Clasp Closure Cash Credit Card Slots Protective Samsung S25 Wallet Case (Rose Gold)

iWEOCO Compatible with Samsung S25 Case Wallet Genuine Leather Anti-Theft RFID Blocking Stand Strong Magnetic Clasp Closure Cash Credit Card Slots Protective Samsung S25 Wallet Case (Rose Gold)

(19)
$16.98$16.13
FREE delivery Sat, Jun 14 on your first order
Loading...
Aswewamt 4 Pcs Mini Backpack Cosmetic Bag Keychain PU Leather Lipstick Holder Cute Case Coin Purse Wallet Card Holder Data Cable Organizer Zipper Pouch Portable Travel Storage Bag for Women, Multicolor

Aswewamt 4 Pcs Mini Backpack Cosmetic Bag Keychain PU Leather Lipstick Holder Cute Case Coin Purse Wallet Card Holder Data Cable Organizer Zipper Pouch Portable Travel Storage Bag for Women, Multicolor

(31)
$15.80
FREE delivery Jul 7 - 28
Loading...
IUQXU for Samsung Galaxy S25 Plus 5G Wallet Phone Case with Screen Protector [RFID Blocking] Leather Flip Card Holder Women Men Cell Phone Case for Samsung S 25 Plus 25S S25+ Galaxy S25Plus 5G Black

IUQXU for Samsung Galaxy S25 Plus 5G Wallet Phone Case with Screen Protector [RFID Blocking] Leather Flip Card Holder Women Men Cell Phone Case for Samsung S 25 Plus 25S S25+ Galaxy S25Plus 5G Black

(0)
$52.77$52.07
FREE delivery Jun 12 - 16
Loading...
MRGLAS 2025 Upgraded Magsafe Car Mount Vacuum Suction Magnetic Phone Holder Car, 360° Foldable Adjustable Suction Cup Phone Stand [89+LBS Suction & 2800gf Magnetic] for Car Accessories iPhone17/16

MRGLAS 2025 Upgraded Magsafe Car Mount Vacuum Suction Magnetic Phone Holder Car, 360° Foldable Adjustable Suction Cup Phone Stand [89+LBS Suction & 2800gf Magnetic] for Car Accessories iPhone17/16

(1,124)
$27.19
1K+ bought in past month
Loading...
OHLPRO Tablet Car Mount Universal Tablet Holder for Car Windshield Dash Dashboard, 360 Degree Rotation,TPU Suction Gel Stick, for iPad Mini 4/3/2/1Samsung Galaxy Size 7"- 10.5" Tablet Mount

OHLPRO Tablet Car Mount Universal Tablet Holder for Car Windshield Dash Dashboard, 360 Degree Rotation,TPU Suction Gel Stick, for iPad Mini 4/3/2/1Samsung Galaxy Size 7"- 10.5" Tablet Mount

(1,515)
$18.99
FREE delivery Tue, Jun 17 on your first order
Loading...
Magnetic Car Mount Air Vent Cell Phone Holder, Universal Vehicle Dash Dashboard Ac Airvent Cellphone Magic Stand with Clip Hook, for iPhone 16 15 Samsung Lenovo Google etc

Magnetic Car Mount Air Vent Cell Phone Holder, Universal Vehicle Dash Dashboard Ac Airvent Cellphone Magic Stand with Clip Hook, for iPhone 16 15 Samsung Lenovo Google etc

(128)
$21.99
FREE delivery Tue, Jun 17 on your first order
Loading...
AINOPE Phone Holder for Car Vent 2025 Gravity Air Vent Car Phone Holder Mount for iPhone 16 Pro Max with Vent Clip Hand Free Cell Phone Car Mount for iPhone 16 Plus Samsung S25 Ultra Car Accesorries

AINOPE Phone Holder for Car Vent 2025 Gravity Air Vent Car Phone Holder Mount for iPhone 16 Pro Max with Vent Clip Hand Free Cell Phone Car Mount for iPhone 16 Plus Samsung S25 Ultra Car Accesorries

(29,179)
$19.99$18.17
FREE delivery Tue, Jun 17 on your first order
2K+ bought in past month
Loading...
BASESAILOR iPhone 16 16e Car Charger Adapter 3Pack,USB to USBC Connector Type C Female to A Male Cable Converter for iPhone 15 14 Pro Max Plus,Apple Watch 10,Airpods 4,iPad mini 7,Samsung Galaxy S25

BASESAILOR iPhone 16 16e Car Charger Adapter 3Pack,USB to USBC Connector Type C Female to A Male Cable Converter for iPhone 15 14 Pro Max Plus,Apple Watch 10,Airpods 4,iPad mini 7,Samsung Galaxy S25

(7,876)
$11.99
FREE delivery Sat, Jun 14 on your first order
500+ bought in past month
Loading...
URVNS 240W USB C Car Charger, Super Fast Charging 4-Ports PD3.1 140W/PD3.0 100W PPS 45W QC65W Type-C Car Adapter for MacBook Pro Laptop iPhone 15 14 Max iPad Samsung Galaxy S24/23/22 Pixel etc

URVNS 240W USB C Car Charger, Super Fast Charging 4-Ports PD3.1 140W/PD3.0 100W PPS 45W QC65W Type-C Car Adapter for MacBook Pro Laptop iPhone 15 14 Max iPad Samsung Galaxy S24/23/22 Pixel etc

(114)
$57.36$49.99
Prime$5.48 delivery Mon, Jun 16
Loading...
UGREEN 130W Car Charger USB C Fast Charger PD3.0 QC4.0 PPS Fast Charging Car Adapter with 100W USB C Cable Compatible with Dell XPS, MacBook, iPhone 16 15 14 Pro Max, Galaxy S25 S24 Ultra, iPad Pro

UGREEN 130W Car Charger USB C Fast Charger PD3.0 QC4.0 PPS Fast Charging Car Adapter with 100W USB C Cable Compatible with Dell XPS, MacBook, iPhone 16 15 14 Pro Max, Galaxy S25 S24 Ultra, iPad Pro

(4,725)
$31.99
500+ bought in past month
Loading...
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

(54,882)
$32.25
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month