πŸ“± Best viewed on desktop. Mobile navigation available at bottom.

DESN378: Code+Design 2 Winter 2026

Sense. Respond. Adapt.

22 students 11 weeks 5 hours/week in class Β· 10 hours/week at home

Week 1: First Light Week 1

Full Week 1 assignment content pulled into the site. Click files in the sidebar to jump directly to each assignment.

Overview

Week 1: First Light

week-1-overview.md

Week 1: First Light

Unit 1: Adaptive Systems Interaction Question: How does it adapt to me?


Learning Outcomes

By the end of this week, students will be able to:

  1. Implement a scalable project structure with separation of concerns
  2. Explain the hierarchy of design systems (system β†’ pattern library β†’ style guide)
  3. Differentiate between primitive and semantic design tokens
  4. Create Figma variables with collections and modes
  5. Build a brand component library (style guide) in Figma
  6. Apply JavaScript fundamentals (querySelector, addEventListener) in a creative project

Two-Day Breakdown

Day 1: Project Structure + Design Systems

Duration: 90 minutes lecture + demo

Time Activity Description
0:00 Learning Log Update README.md with Week 0 reflections
0:15 Project Structure File organization, separation of concerns
0:35 Design Systems Hierarchy System β†’ Pattern Library β†’ Style Guide
0:50 Break β€”
1:00 Design Tokens Primitives vs. Semantic, naming conventions
1:15 Figma Variables Demo Live demo of token pipeline
1:35 Closing Assignments overview

Deliverables assigned:

  • Build 1-1: Portfolio Migration
  • Learn 1-0: Codedex Variables
  • Learn 1-1: HTML Academy Ch. 2
  • Engage 1-3: Style Tile (complete before Learn 1-2)
  • Learn 1-2: Figma Variables tutorial

Day 2: Figma Variables + Workshop

Duration: 30 minutes lecture + 60 minutes workshop

Time Activity Description
0:00 Learning Log 15-minute reflection check-in
0:15 Variables Deep Dive Collections, modes, applying variables
0:30 Token Naming Semantic naming exercise
0:40 Break β€”
0:50 Workshop Time Build your style guide
1:25 Closing Weekend assignments, Week 2 preview

Deliverables assigned:

  • Build 1-2: The Foundation (Brand Component Library)
  • Practice 1-1: The Story Teller
  • Reflect 1-1: Visual Notes on Design Systems

Activities

Type Activity Points Due
Engage 1-1 VS Code Theme Setup 10 Day 1
Engage 1-2 Learning Log 10 Day 1 (in-class)
Engage 1-3 Style Tile 5 Before Day 2
Learn 1-0 Codedex Variables 10 Before Day 2
Learn 1-1 HTML Academy Ch. 2 10 Before Day 2
Learn 1-2 Figma Variables 10 Before Day 2
Practice 1-1 The Story Teller 20 Sunday
Build 1-1 Portfolio Migration 10 Before Day 2
Build 1-2 The Foundation 30 Sunday
Reflect 1-1 Visual Notes: Design Systems 10 Sunday

See engage/, learn/, practice/, build/, and reflect/ folders for activity files.


Topics Covered

Concept Depth Notes
Project structure Practical File organization, folders, naming
Design systems hierarchy Conceptual System β†’ Pattern Library β†’ Style Guide
Design tokens Deep Primitives, semantic, naming conventions
Figma variables Hands-on Collections, modes, applying
JavaScript review Reinforcement querySelector, addEventListener, classList

Project Milestone

Project 1: "The System" β€” Assigned this week, due end of Week 2

This week students:

  • Create token system in Figma (colors, typography, spacing)
  • Build style guide with light/dark modes
  • Prepare foundation for code implementation in Week 2

Assigned Reading/Tutorials

Resource Type Required
HTML Academy: Introduction to JavaScript Tutorial Yes
Design Systems 101 Article Yes
NN Group Design Systems 101 Article Yes
Penpot Intro to Design Tokens Article Yes

Key Vocabulary

Term Definition
Design System Collection of reusable components and standards
Style Guide Visual foundation: colors, typography, spacing
Design Token A design decision stored as data
Primitive Token Raw value named by what it IS (blue-500, gray-900)
Semantic Token Value named by what it DOES (action-primary, text-primary)
Figma Variable Design-side equivalent of CSS Custom Property
Collection Group of related variables in Figma
Mode Variable variant (light mode, dark mode)

Common Struggles & Solutions

Struggle Solution
"What colors should I use?" Start with your existing portfolio colors
"Primitives vs. semantic?" Primitives = raw values, Semantic = meaningful names
"Mode switching doesn't work" Check that variables are applied, not hardcoded
"Too many tokens" Start minimal: 5 colors, 3-5 spacing values

Resources

Videos

Resource Description
Design Tokens for Dummies Comprehensive token overview
CSS Variables in 100 Seconds Fireship quick intro
CSS Custom Properties Kevin Powell deep dive

Figma

Resource Description
Variables Playground Official practice file
FreeCodeCamp Handbook Written tutorial

Tools

Tool Use For
OpenProps Token value reference
Color Blind Simulator Accessibility testing

Accessibility Notes

  • Test color combinations for sufficient contrast
  • Use Color Blind Simulator to verify color choices
  • Semantic naming supports future accessibility features
  • Preview: prefers-reduced-motion implementation in Week 2

Connections

Connects To How
Week 0 JavaScript fundamentals practiced in Story Teller
Week 2 Figma tokens become CSS Custom Properties
Week 3 SVG colors use same token system
Week 5+ Motion tokens (duration, easing)
Project 1 This is the design foundation of "The System"

Instructor Notes

  • Learning Log check-in on Day 2 sets collaborative tone
  • The token naming discussion generates good questions
  • Students will be at different Figma skill levels β€” pair up
  • Focus on colors first; spacing can be stretch goal
  • Watch for hardcoded colors vs. applied variables

Materials Checklist

  • Lecture 1 slides/outline ready
  • Lecture 2 slides/outline ready
  • Engage 1-1: VS Code Theme Setup posted
  • Engage 1-3: Style Tile posted + Figma template created
  • Learn 1-1: HTML Academy guide posted
  • Learn 1-2: Figma Variables guide posted
  • Practice 1-1: The Story Teller posted
  • Build 1-1: Portfolio Migration posted
  • Build 1-2: The Foundation posted
  • Reflect 1-1: Visual Notes posted
  • Figma Variables Playground shared
  • Resources page updated

Lectures

Lecture 1: Project Structure + Design Systems

lectures/lecture-1-project-structure-design-systems.md

Lecture 1: Project Structure + Design Systems

Week 1: The Structure of Design // Systems and Tokens Day 1 Duration: 85 minutes (excludes 15-min Learning Log opening) Format: Lecture + Discussion


Learning Objectives

By the end of this lecture, students will:

  • Understand and implement a scalable project structure
  • Explain what normalize/reset CSS does and why we use it
  • Describe the hierarchy of design systems (conceptual)
  • Trace the event flow from user action to UI update
  • Know where to find selector references for JavaScript

Pre-Lecture Setup

  • VS Code open with example project structure
  • Browser with design system examples ready (Spectrum, Material, Primer)
  • Event flow diagram ready to display

Lecture Outline

Section Time Content
Project Structure 25 min Folder scaffold, normalize/reset intro
Design Systems Intro 20 min Conceptual only β€” no Figma yet
Event Flow 15 min Walk through the diagram
Selector Cheatsheet 15 min Reference before MDN/Story Teller
Preview + Assignments 10 min What's coming

Part 1: Project Structure (25 min)

Opening: Why Structure Matters

"Before we build anything, we need to know where things go."

Show a messy project:

my-site/
β”œβ”€β”€ style.css
β”œβ”€β”€ styles.css
β”œβ”€β”€ main.css
β”œβ”€β”€ script.js
β”œβ”€β”€ app.js
β”œβ”€β”€ image1.jpg
β”œβ”€β”€ IMG_4532.png
β”œβ”€β”€ hero.jpg
└── index.html

Question: "What's wrong with this?"

The Standard Structure

[SHOW ON SCREEN]

/project-name/
β”œβ”€β”€ index.html
β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ normalize.css
β”‚   β”œβ”€β”€ variables.css
β”‚   └── style.css
β”œβ”€β”€ js/
β”‚   β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ components/
β”‚   └── script.js
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ fonts/
β”‚   └── icons/
└── README.md

Walk Through Each Part

index.html β€” The entry point

  • DOCTYPE declaration
  • Meta tags (charset, viewport, description)
  • Link CSS in head, JS before closing body
  • Semantic HTML5 elements

css/ directory:

File Purpose
normalize.css Browser reset, consistent baseline
variables.css Design tokens (colors, spacing, typography)
style.css Component styles, layout, utilities

What Is Normalize/Reset?

"Browsers have opinions. They don't agree."

The problem: Different browsers render elements differently by default.

  • Safari's button looks different from Chrome's
  • Firefox has different default margins
  • Your design breaks unexpectedly

The solution: Reset those defaults to a consistent baseline.

<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/style.css">

Order matters: normalize β†’ variables β†’ style

Key point: "You don't write this file. You download it and include it."

scripts/` directory:

Folder/File Purpose
main.js Main entry point, initialization
utils/ Helper functions, data manipulation
components/ UI component logic

assets/ directory:

Folder Contents
images/ Photos, graphics, backgrounds
fonts/ Custom font files
icons/ SVG icons, favicons

README.md β€” Project documentation

  • What is this project?
  • How do I run it?
  • What are the dependencies?

Key Principle: Separation of Concerns

"Each file has one job. Each folder groups related things."

  • CSS files don't contain JavaScript
  • JavaScript files don't contain CSS
  • Assets are separate from code
  • Tokens are separate from component styles

Part 2: Design Systems Intro (20 min) β€” LIGHTER VERSION

Opening: What Is a Design System?

"A design system is a collection of reusable components, guided by clear standards, that can be assembled to build any number of applications."

But that's abstract. Let's make it concrete.

The Three Layers

[DRAW ON BOARD or SHOW DIAGRAM]

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DESIGN SYSTEM                               β”‚
β”‚  Technical specs, tokens, documentation,     β”‚
β”‚  principles, processes                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  PATTERN LIBRARY                             β”‚
β”‚  Templates, layouts, interactions,           β”‚
β”‚  code snippets, components                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  STYLE GUIDE                                 β”‚
β”‚  Colors, typography, icons, logos,           β”‚
β”‚  illustrations, brand guidelines             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Style Guide β€” The visual foundation (what we're building) Pattern Library β€” Reusable pieces Design System β€” The complete package

Real Examples (Show, Don't Deep Dive)

[SHOW BRIEFLY]

"These teams have hundreds of engineers. Why do they invest in design systems?"

  • Consistency across products
  • Faster development
  • Single source of truth

The Bridge Statement

"The way design systems solve this problem is with variables β€” named values that can change. Figma has them. CSS has them. JavaScript can control them. That's what this quarter is about: connecting all three."

[SHOW VISUAL]

Figma Variables  ←→  CSS Custom Properties  ←→  JavaScript
     ↑                      ↑                      ↑
  (design)              (styling)              (behavior)

"Day 2, we'll get into the details. Today, just know this connection exists."


Part 3: Event Flow (15 min)

"Before we dive into Figma and design tokens, let's reinforce what you learned in Week 0 about JavaScript."

The Event Flow Diagram

[WALK THROUGH SLOWLY]

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Action   β”‚  ← click, hover, keypress
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Event Listener β”‚  ← addEventListener
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  State Change   β”‚  ← classList.toggle, variable update
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   UI Updates    β”‚  ← CSS responds to new class/state
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Read each box aloud:

  1. User does something (clicks a button)
  2. JavaScript listens for that action (addEventListener)
  3. JavaScript changes some state (adds/removes a class)
  4. CSS responds to the new state (different styles apply)

The Key Insight

"JavaScript doesn't change colors directly. It changes state. CSS responds to state."

Example:

button.addEventListener('click', function() {
  document.body.classList.toggle('dark-mode');
});

JavaScript just toggles a class. CSS does the visual work:

body { background: white; }
body.dark-mode { background: #1a1a1a; }

This mental model helps for the Story Teller practice and everything we build this quarter.


Part 4: Selector Cheatsheet (15 min)

"You used these in Week 0. Let's make sure you know where to look."

The Most Common Selectors

Selector Example What it finds
.class .story-image Elements with that class
#id #story-caption The one element with that ID
[data-*] [data-step="1"] Elements with that attribute
element img All elements of that type

In Code

// Find one element
const caption = document.querySelector('#story-caption');
const image = document.querySelector('.story-image img');

// Find many elements
const dots = document.querySelectorAll('.dot');

DevTools Trick

[DEMONSTRATE]

  1. Right-click any element in the page
  2. Inspect
  3. Right-click the element in DevTools
  4. Copy β†’ Copy selector

Common Mistake

Forgetting the dot or hash:

// WRONG β€” will not find anything
document.querySelector('story-image');

// RIGHT β€” includes the dot for class
document.querySelector('.story-image');

"You don't need to memorize all of this. You need to know where to look."


Part 5: Preview + Assignments (10 min)

Assignments

  1. Build 1-1: Portfolio Migration

    • Move your portfolio to the new folder structure
    • Due before Day 2
  2. Learn 1-0: Codedex Variables

    • Exercises 6-10 on codedex.io/javascript
    • Covers let, const, data types, math with variables
    • Due before Day 2
  3. Learn 1-1: HTML Academy

    • Theme switcher tutorial
    • Due before Day 2
  4. Learn 1-2: Figma Variables

Remind: Engage activity (VS Code Theme Setup) if not done.

Preview

"Day 2, we dive into Figma Variables. You'll create your own token system β€” primitives, semantic tokens, light/dark modes. By Sunday, you'll have a complete style guide in Figma."

"Week 2, we translate that system into CSS and JavaScript. The variables you create in Figma become CSS Custom Properties in your code."


Slide Outline

  1. Title: "The Structure of Design // Systems and Tokens"
  2. Messy project structure example
  3. Clean project structure diagram
  4. What is normalize/reset?
  5. CSS organization (normalize β†’ variables β†’ style)
  6. Design system hierarchy diagram
  7. Real design system examples (brief)
  8. Bridge statement (Figma ↔ CSS ↔ JS)
  9. Event Flow diagram
  10. JavaScript ↔ CSS relationship
  11. Selector cheatsheet
  12. DevTools trick
  13. Assignments + Preview

Resources to Reference

Design Systems:

Design Tokens:

CSS Variables:


Common Questions

"Why not just use Figma styles?" Variables can have modes (light/dark). Styles cannot. Variables can also do math and be referenced by other variables.

"Do we need all these files?" For small projects, maybe not. But learning the pattern now means you're ready for larger projects.

"Why separate normalize, variables, and style?" Separation of concerns. Normalize is third-party. Variables are your design decisions. Style is your implementation.


Instructor Notes

  • The structure section might feel dry β€” keep it moving
  • Show real examples of messy vs. clean projects
  • Design systems section is intentionally lighter β€” save token details for Day 2
  • The Event Flow diagram is key β€” walk through it slowly, relate to Week 0 MDN tutorial
  • Selector cheatsheet is a reference, not memorization β€” show the DevTools trick
  • Students may struggle with the dot/hash β€” emphasize this common mistake
  • Connect everything to the Story Teller practice they'll do this week

Lecture 2: Figma Variables + Workshop

lectures/lecture-2-figma-variables-workshop.md

Lecture 2: Figma Variables + Workshop

Week 1, Day 2 Duration: 45 min lecture + 60 min workshop (105 min total) Format: Demo + Hands-on Practice


Learning Objectives

By the end of this session, students will:

  • Create variables in Figma for colors, numbers, and booleans
  • Organize variables into collections with modes
  • Apply semantic naming conventions
  • Build a basic style guide using their token system

Pre-Session Setup

  • Figma open with Variables Playground
  • Student portfolios recreated in Figma (or in progress)
  • Style guide template ready to share

Session Outline

Part 1: Learning Log Check-In (10 min)

Template questions to display:

  1. What did you learn since last class?
  2. What was hard?
  3. How did you use AI this week?
  4. What is still giving you issues?

Have students spend 3 minutes writing, then share with a neighbor (2 min pairs, 5 min class discussion).


Part 2: Figma Variables Deep Dive (25 min)

Quick Check: Who Did the Learn Activity?

Show of hands:

  • Who completed Learn 1-2 (Figma Variables)?
  • Who got mode switching to work?
  • What questions came up?

If many didn't complete it: Take 5 minutes for them to open the Variables panel and create one variable. Then continue.

Quick Review from Day 1

PRIMITIVES           β†’    SEMANTIC
(raw values)              (meaningful names)
─────────────────         ─────────────────
blue-500: #0066CC   β†’    action-primary
gray-900: #1A1A1A   β†’    text-primary
white: #FFFFFF      β†’    surface-primary

Variable Types in Figma

Type Stores Use For
Color Hex values Fills, strokes, backgrounds
Number Integers/decimals Spacing, radius, sizes
String Text Font families (limited use)
Boolean true/false Layer visibility, variants

This week: Focus on Color and Number

Creating Variables β€” Live Demo

[DEMO: Create a Primitives Collection]

  1. Open Local Variables panel (right sidebar or View β†’ Local Variables)
  2. Click "Create collection" β†’ Name it "Primitives"
  3. Create color variables:
    colors/blue/500    #0066CC
    colors/blue/600    #0052A3
    colors/gray/100    #F5F5F5
    colors/gray/900    #1A1A1A
    colors/white       #FFFFFF
    colors/black       #000000
    
  4. Create spacing variables:
    spacing/base       8
    spacing/xs         4
    spacing/sm         8
    spacing/md         16
    spacing/lg         24
    spacing/xl         32
    

Key points:

  • Use / for hierarchy (creates folders)
  • Be consistent with naming
  • Primitives are raw values β€” no modes yet

Creating Semantic Variables with Modes

[DEMO: Create a Semantic Collection]

  1. Create new collection β†’ "Semantic"
  2. Add a mode: Light (default), then add Dark mode
  3. Create variables that reference primitives:

Light Mode:

surface/primary      β†’ {Primitives/colors/white}
surface/secondary    β†’ {Primitives/colors/gray/100}
text/primary         β†’ {Primitives/colors/gray/900}
text/secondary       β†’ {Primitives/colors/gray/600}
action/primary       β†’ {Primitives/colors/blue/500}
action/primary-hover β†’ {Primitives/colors/blue/600}
border/primary       β†’ {Primitives/colors/gray/200}

Dark Mode:

surface/primary      β†’ {Primitives/colors/gray/900}
surface/secondary    β†’ {Primitives/colors/gray/800}
text/primary         β†’ {Primitives/colors/white}
text/secondary       β†’ {Primitives/colors/gray/300}
action/primary       β†’ {Primitives/colors/blue/400}
action/primary-hover β†’ {Primitives/colors/blue/300}
border/primary       β†’ {Primitives/colors/gray/700}

Applying Variables

[DEMO: Apply to a frame]

  1. Select a frame
  2. In fill, click the variable icon
  3. Choose semantic variable (e.g., surface/primary)
  4. Switch modes in the layer panel
  5. Watch colors change automatically

The magic moment: Everything updates when you switch modes.


Part 3: Token Naming Deep Dive (10 min)

Note: If running short on time, this can be condensed to 5 min by focusing on the exercise rather than the full explanation.

The Nathan Curtis Approach

Naming pattern: category/property/variant

Category Examples
surface/ primary, secondary, elevated
text/ primary, secondary, muted, inverse
action/ primary, secondary, destructive
border/ primary, secondary, focus
spacing/ xs, sm, md, lg, xl

Why This Matters

Bad names:

blue-button-color
white-background
dark-text

Good names:

action/primary
surface/primary
text/primary

The test: "If the brand color changes from blue to purple, do my token names still make sense?"

Exercise: Name These Tokens

Show a UI and have students suggest token names:

  • The background of a card
  • The text on a button
  • The border of an input field
  • The hover state of a link

Part 4: Workshop Time (60 min)

Your Task: Build Your Token System

Goal: By the end of workshop, you should have:

  • A Primitives collection with your brand colors
  • A Semantic collection with Light/Dark modes
  • At least one component (button) using semantic tokens
  • A style guide frame that switches between modes

Using your portfolio as the source:

  1. Audit your existing colors

    • What colors are you using?
    • What are they used FOR?
  2. Create a Primitives collection

    • Your brand colors
    • Neutral grays
    • White and black
  3. Create a Semantic collection

    • Light mode first
    • Then dark mode
    • Reference primitives, not hex values
  4. Apply to a style guide frame

    • Color swatches with labels
    • Typography samples
    • Spacing demonstrations

Style Guide Template

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  YOUR BRAND β€” Style Guide                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                              β”‚
β”‚  COLORS                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”        β”‚
β”‚  β”‚    β”‚ β”‚    β”‚ β”‚    β”‚ β”‚    β”‚ β”‚    β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”˜        β”‚
β”‚  surface text   text  action border         β”‚
β”‚  primary primary sec.  primary primary      β”‚
β”‚                                              β”‚
β”‚  TYPOGRAPHY                                  β”‚
β”‚  Heading 1 (H1)                             β”‚
β”‚  Heading 2 (H2)                             β”‚
β”‚  Body text paragraph                         β”‚
β”‚  Caption / small text                        β”‚
β”‚                                              β”‚
β”‚  SPACING                                     β”‚
β”‚  β”Œβ”€β”€β” xs (4px)                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β” sm (8px)                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” md (16px)                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” lg (24px)                   β”‚
β”‚                                              β”‚
β”‚  COMPONENTS                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚  Primary    β”‚  β”‚  Secondary  β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β”‚                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Instructor Circulation

While students work, check for:

  • Are they using semantic names or just "color1, color2"?
  • Do their semantic tokens reference primitives?
  • Have they set up both modes?
  • Are variables actually applied (not hardcoded colors)?

Closing (5 min)

Progress Check

Show of hands:

  • Who has primitives set up?
  • Who has semantic variables with modes?
  • Who got mode switching to work?

This Weekend

  1. Build 1-2: The Foundation β€” Complete your style guide
  2. Practice 1-1: The Story Teller β€” Creative JavaScript exercise
  3. Reflect 1-1: Visual Notes β€” Capture design systems concepts

Next Week Preview

"Next week, we translate this Figma system into CSS. Your variables.css file will mirror what you built today. Then we add JavaScript to toggle between modes."


Resources for Workshop

Figma:

Token Naming:

Accessibility:


Common Issues During Workshop

"I can't find the Variables panel"

  • View β†’ Local Variables
  • Or click the variable icon in the right sidebar

"My variables aren't showing when I try to apply them"

  • Make sure the variable is scoped to the property you're using (fill, stroke, etc.)
  • Check the collection is published to the file

"Mode switching doesn't work"

  • Variables must be applied, not hardcoded
  • The frame needs to be set to use that collection's mode

"I don't know what colors to use"

  • Start with what you have in your portfolio
  • Use OpenProps as a reference for values
  • Aim for 3-5 colors, not 20

Instructor Notes

  • The Learning Log check-in sets a good collaborative tone
  • Students will be at different Figma skill levels β€” pair advanced with beginners
  • The workshop time should feel productive, not rushed
  • Focus on primitives + semantic for colors first; spacing can be stretch
  • Have students share screens to troubleshoot

Lecture 2: Tokens in Practice

lectures/lecture-2-tokens-in-practice.md

Lecture 2: Tokens in Practice

Week 1, Day 2 Duration: 30 minutes Format: Discussion + Live Debugging + Exercise


Learning Objectives

By the end of this lecture, students will:

  • Understand common JavaScript errors and how to read them
  • Know the difference between semantic and literal token naming
  • See how their token system will grow throughout the quarter
  • Be ready for structured work time

Pre-Lecture Setup

  • A student repo with a common bug (or your own intentionally broken demo)
  • DevTools Console open
  • Whiteboard or shared screen for token naming exercise

Lecture Outline

Part 1: What Did You Learn? (10 min)

Quick Check-In

"How did the MDN tutorial go?"

  • Hands up: Who got through the whole thing?
  • What clicked?
  • What was confusing?

"How about Lab 1-1?"

  • Who has a working toggle?
  • Who got stuck somewhere?

Common Wins to Celebrate

  • "I made the colors change!"
  • "I saw the class appear in DevTools!"
  • "I finally understand what querySelector does!"

"These are real accomplishments. You wrote JavaScript that works."


Part 2: Reading Errors (10 min)

The Console Is Your Friend

"When JavaScript breaks, it tells you. You just have to know where to look."

[DEMO] Open a broken example:

const toggle = document.querySelector('.theme-togle'); // typo!
toggle.addEventListener('click', function() {
  document.body.classList.toggle('dark');
});

[SHOW CONSOLE]

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
    at script.js:2:8

Anatomy of an Error

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
β”‚              β”‚                            β”‚                    β”‚
β”‚              β”‚                            β”‚                    └── what it tried to do
β”‚              β”‚                            └── what it found (null = nothing)
β”‚              └── type of error
└── it wasn't caught/handled

    at script.js:2:8
         β”‚        β”‚ β”‚
         β”‚        β”‚ └── character position
         β”‚        └── line number
         └── file name

"Line 2, character 8. That's exactly where to look."

The Most Common Error

Cannot read properties of null = querySelector found nothing

Why it happens:

  1. Typo in selector (.theme-togle vs .theme-toggle)
  2. Forgot the dot (.classname vs classname)
  3. Script runs before HTML exists (missing defer)

[DEMO] Fix the typo, show it working.

Script Loading: The defer Attribute

"Your JavaScript runs as soon as the browser sees it. If the HTML isn't loaded yet, there's nothing to find."

<!-- BAD: Script runs immediately, HTML might not exist yet -->
<script src="script.js"></script>

<!-- GOOD: Script waits until HTML is parsed -->
<script src="script.js" defer></script>

"Always use defer unless you have a specific reason not to."


Part 3: Token Naming Exercise (10 min)

The Setup

[SHOW] A design with 5 colors:

  • White background
  • Dark gray text
  • Blue accent/links
  • Light gray secondary background
  • Red for errors

"Write down names for these as CSS variables. You have 2 minutes."

Compare and Discuss

"Pair up. Compare your names."

Common patterns that emerge:

Literal (Describes Appearance) Semantic (Describes Purpose)
--color-white --color-surface
--color-dark-gray --color-text
--color-blue --color-accent
--color-light-gray --color-surface-secondary
--color-red --color-error

Why Semantic Names Win

"What happens to --color-blue when your brand changes to green?"

"Your code is full of 'blue' but it's actually green. Future-you is confused."

"Semantic names describe purpose, not appearance."

/* This makes sense even if the actual color changes */
.button {
  background: var(--color-accent);
}

/* This becomes a lie when the brand changes */
.button {
  background: var(--color-blue);
}

Real-World Reference

"Open Props uses semantic groupings:"

  • --gray-0 through --gray-12 for a scale
  • --red-0 through --red-12 for another

"They use literal names, but they're a library, not a brand. Your portfolio should use semantic names."


Transition to Work Time

File Structure Check

"Before you start Lab 1-2, let's make sure your files are organized:"

portfolio/
β”œβ”€β”€ index.html
β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ variables.css    ← NEW: your tokens
β”‚   └── styles.css       ← uses the tokens
└── js/
    └── theme.js         ← toggle logic

Start Minimal

"Your variables.css should start small:"

  • 3-5 color tokens
  • 2-3 spacing values
  • 1-2 font families

"You can always add more. Don't over-engineer on day one."

Where the Toggle Goes

"Think about placement in your portfolio:"

  • Header (common)
  • Footer (Stripe does this)
  • Floating button (visible on all pages)
  • Hidden in a menu (less discoverable)

"There's no wrong answer, but it should be findable."

Preview: What's Coming

"Next week, we add two things:"

  1. localStorage β€” The browser remembers their choice
  2. System preference detection β€” First-time visitors get their OS preference

"Your toggle becomes a real, polished feature."


Assignments Reminder

  • Lab 1-2: "The Inheritance" β€” Due Sunday

    • Create variables.css
    • Refactor one page to use tokens
    • Add working toggle
  • Visual Notes β€” Due Sunday

    • Figma Design Systems readings
    • Come ready to discuss
  • Project 1: "The System" β€” Due end of Week 2

    • Everything this week builds toward this

Slide Outline (if using slides)

  1. Title: "Tokens in Practice"
  2. Check-in questions
  3. Error anatomy diagram
  4. Common error: null
  5. The defer attribute
  6. Token naming exercise prompt
  7. Literal vs Semantic comparison
  8. File structure diagram
  9. "Start minimal" list
  10. Assignments reminder

Instructor Notes

  • Day 2 is shorter lecture, longer work time
  • The naming exercise often sparks good discussion β€” let it run if engaged
  • Students stuck on Lab 1-1 need one-on-one time during work session
  • Watch for script loading issues β€” very common
  • If class is ahead, show Open Props briefly as inspiration

Engage

Engage: VS Code Theme Setup

engage/engage-1-1-vscode-theme-setup.md

Engage: VS Code Theme Setup

Points: 10 (Complete/Incomplete) Time Estimate: 15–20 minutes


TL;DR

Install a VS Code theme, enable Settings Sync, and submit a screenshot of your themed editor.


Submit

Upload a screenshot showing:

  • Your VS Code window with the custom theme active
  • Some code visible in the editor (can be any file)

Overview

Personalize your development environment by installing a VS Code theme and enabling Settings Sync. This ensures your preferences persist across GitHub Codespaces and local installations.

Why This Matters:

  • A comfortable workspace improves focus and reduces fatigue
  • Settings Sync means your setup follows you everywhere
  • Sharing themes builds community and personal expression

Step 1: Install Your Desired Theme

  1. Open the Extensions view in VS Code (Cmd+Shift+X on Mac, Ctrl+Shift+X on Windows)
  2. Search for your desired theme (e.g., "Night Owl", "GitHub Dark", "Fairyfloss", "One Dark Pro")
  3. Click Install on the theme's page

Popular themes to explore:

  • Night Owl (by Sarah Drasner)
  • GitHub Dark Default
  • Dracula Official
  • One Dark Pro
  • Fairyfloss
  • Catppuccin

Step 2: Set the Theme as Your Color Theme

  1. Open the Command Palette (Cmd+Shift+P on Mac, Ctrl+Shift+P on Windows)
  2. Type color theme and select Preferences: Color Theme
  3. Use arrow keys to preview themes
  4. Press Enter to select your preferred theme

This selection is saved in your user settings.


Step 3: Enable Settings Sync

Settings Sync persists your settings across different codespaces and machines.

  1. Click the Accounts icon at the bottom of the Activity Bar (looks like a person)
  2. Select Turn on Settings Sync...
  3. Sign in with your GitHub account if prompted
  4. In the dialog, ensure these are selected:
    • Settings
    • Extensions
    • UI State
  5. Click OK or Sign in to Sync Settings

If prompted for authorization, click Authorize in the browser window.


Step 4: Configure GitHub Codespaces Preferences

Ensure new codespaces automatically use your synced settings:

  1. Go to github.com/settings/codespaces
  2. Under Settings Sync, ensure the Enable checkbox is selected
  3. Under Trusted repositories, choose:
    • All repositories (recommended for this class)
    • Or select specific repositories

Complete Criteria

Your setup is complete when:

  • A custom theme is installed and active
  • Settings Sync is enabled and connected to GitHub
  • GitHub Codespaces preferences are configured

Share Your Theme

Take a moment to share your theme choice with a neighbor:

  • What drew you to this theme?
  • Does it have good contrast for long coding sessions?
  • Light mode or dark mode person?

Troubleshooting

"Settings Sync won't enable"

  • Make sure you're signed into GitHub in VS Code
  • Check that your GitHub account has the correct permissions

"Theme doesn't look right in Codespaces"

  • Reload the Codespace window (Cmd+Shift+P β†’ "Developer: Reload Window")
  • Check that Settings Sync finished syncing (look for the sync icon)

"I want to change my theme later"

  • Just repeat Step 2 anytime β€” your choice is automatically synced

Connection to This Week

Your VS Code setup is part of your development environment β€” one piece of the larger project structure we're building this week. A well-organized workspace (both visual and file structure) supports better design thinking.

Engage 1-2: Learning Log

engage/engage-1-2-learning-log.md

Engage 1-2: Learning Log

Points: 10 (Complete/Incomplete) Time: 15 minutes (in-class) Location: Your portfolio repo β†’ README.md


TL;DR

Update your learning log (README.md) with reflections on Week 0 and list the work you completed.


Overview

Your learning log lives in your portfolio's README.md file β€” not the website itself. This is where you track your progress, reflect on challenges, and document your learning journey throughout the course.

Each week, you'll spend the first 15 minutes of Day 1 updating your log.


Template

Copy this template into your README.md and fill it out:

# Learning Log

## Week 1

### What I Learned
<!-- What concepts clicked for you? What was new? -->


### What Was Hard
<!-- What frustrated you? What didn't make sense? -->


### How I Used AI
<!-- Did you use Copilot, ChatGPT, etc.? How did it help or not help? -->


### What's Still Unclear
<!-- What questions do you still have? What needs more practice? -->


### Work Completed (Week 0)

**Engage**
- [ ] Portfolio Audit

**Learn**
- [ ] Console Explorer
- [ ] Codedex Console Fundamentals

**Reflect**
- [ ] Visual Notes: Variables and Strings

**Build**
- [ ] The Setup
- [ ] The Behavioral Layer

---

Instructions

  1. Open your portfolio repo in VS Code
  2. Open README.md (create it if it doesn't exist)
  3. Add the Week 1 section using the template above
  4. Fill in your reflections (be honest β€” this is for you)
  5. Check off the work you completed from Week 0
  6. Commit and push

Why README.md?

Your README is:

  • The first thing people see on your GitHub repo
  • A place for documentation, not display
  • Markdown-based (good practice)
  • Separate from your portfolio website content

Think of it as your course journal that lives alongside your code.


Complete Criteria

  • README.md exists in your portfolio repo
  • Week 1 section added with all four reflection questions
  • Week 0 work checklist included
  • Committed and pushed to GitHub

Example Entry

## Week 1

### What I Learned
The console is way more useful than I thought. I can actually see what's
happening in my code instead of just guessing. Variables make more sense
now β€” they're like containers with labels.

### What Was Hard
Getting GitHub Desktop to work with my repo took forever. Also the
difference between let and const is still fuzzy.

### How I Used AI
I asked Copilot to explain what console.log does. It helped but I had
to actually try it myself to really get it.

### What's Still Unclear
When do I use querySelector vs getElementById? Are they the same thing?

### Work Completed (Week 0)

**Engage**
- [x] Portfolio Audit

**Learn**
- [x] Console Explorer
- [x] Codedex Console Fundamentals

**Reflect**
- [x] Visual Notes: Variables and Strings

**Build**
- [x] The Setup
- [ ] The Behavioral Layer (still working on it)

Connection to Portfolio

Your README shows:

  • You can write documentation
  • You reflect on your learning process
  • You track your own progress
  • You understand version control workflow

Employers and instructors look at READMEs. A thoughtful learning log demonstrates self-awareness and growth mindset.

Engage: Style Tile

engage/engage-1-3-style-tile.md

Engage: Style Tile

Points: 5 (Complete/Incomplete) Time Estimate: 15–20 minutes Platform: Figma


TL;DR

Extract your portfolio's colors and fonts into a style tile frame in Figma. This becomes the foundation for your Figma Variables.


Submit

No separate submission β€” your style tile is part of Build 1-2.


Overview

Before you learn Figma Variables, you need to know what values you're turning into variables. This quick activity captures your design decisions in a simple template.

Think of it like this:

  • Style tile = your design decisions (colors, fonts)
  • Figma Variables = those decisions as reusable, switchable values
  • CSS Custom Properties = those variables in code

You can't build variables without knowing what values to put in them.


Step 1: Get Your Portfolio into Figma

You need your portfolio design in Figma to extract colors and fonts from.

If you have your portfolio Figma file from DESN368:

Open it. You're ready for Step 2.

If you don't have it in Figma (or you've redesigned your site):

Use the HTML to Design plugin to import your live site:

  1. Install HTML to Design by Divriots
  2. Create a new Figma file
  3. Run the plugin: Plugins β†’ HTML to Design
  4. Paste your portfolio URL
  5. The plugin imports your site as Figma frames

This gives you a visual reference to pull colors and fonts from.


Step 2: Extract Your Style Tile

From your portfolio Figma file, identify and document these:

Colors (5 minimum)

Look at your portfolio and find:

Role What it's for Where to find it
Brand Your primary brand color Main accent, buttons, links
Accent Secondary/highlight color Hover states, secondary elements
Light Light background Page background, card fills
Dark Dark text or background Headings, body text
Gray Neutral, borders, muted text Borders, captions, dividers

How to grab hex values in Figma:

  1. Select an element with the color you want
  2. Look at the Fill in the right panel
  3. Click the color swatch to see the hex code

Fonts (2)

Role Where to find it
Headings Your h1, h2, section titles
Body Paragraphs, descriptions

How to identify fonts in Figma:

  1. Select a text element
  2. Look at the Text section in the right panel
  3. Note the font family and weight

Dark Mode Preview

Before you build variables, think about how your colors flip:

Light Mode Dark Mode
Light background Dark background
Dark text Light text
Brand color Brand color (maybe lighter?)

Sketch or imagine: What does your site look like with colors inverted?


Step 3: Document Your Choices

Create a new frame in your Figma file called "Style Tile" with:

  • 5 color swatches (rectangles with your colors)
  • Labels under each with the hex value and role
  • Text samples showing your heading and body fonts
  • A note about your dark mode color swaps

This becomes your reference for Learn 1-2 and Build 1-2.


Complete Criteria

You're ready for Learn 1-2 if you have:

  • Your portfolio in Figma (existing file or imported via HTML to Design)
  • 5 colors identified (with hex values)
  • 2 fonts identified
  • A "Style Tile" frame documenting these choices
  • A rough idea of your dark mode color swaps

What's Next

After completing this:

  1. Learn 1-2 β€” You'll learn how to turn these colors into Figma Variables with light/dark modes
  2. Day 2 Workshop β€” You'll build the full variable system in class
  3. Build 1-2 β€” You'll complete your Brand Component Library

Your style tile is the foundation. Everything builds from these decisions.


Why This Matters

"A design system without defined values is just a collection of opinions."

By extracting your colors and fonts before creating variables:

  • You avoid decision paralysis during the tutorial
  • Your Learn 1-2 practice uses YOUR actual values
  • Day 2 workshop is about applying tools, not making decisions on the fly
  • Your Figma Variables will directly match your portfolio

15 minutes now saves confusion later.

Learn

Learn: Codedex Variables Tutorial

learn/learn-1-0-codedex-variables.md

Learn: Codedex Variables Tutorial

Points: 10 (Complete/Incomplete) Time Estimate: 45–60 minutes Platform: Codedex.io


TL;DR

Complete 5 Codedex exercises on variables and data types, then consolidate into a single JS file.


Submit

The link to week-1/learn/tutorial-1-0-codedex-variables.js on GitHub


Overview

Week 0 introduced console.log() and comments. Now you'll learn variables β€” containers that store values you can use and change throughout your code.

Variables are fundamental to everything we'll build this semester. Want to remember a user's theme preference? That's a variable. Want to track how many times someone clicked a button? Variable. Want to store a color value? Variable.

After completing the exercises on Codedex, you'll consolidate everything into a single JavaScript file and submit it.


What You're Learning

  • How to declare variables with let and const
  • The difference between let (can change) and const (can't change)
  • JavaScript data types: strings, numbers, booleans, undefined
  • How to do math with variables
  • How to combine variables in output

The Exercises

Go to codedex.io/javascript and complete the 5 exercises on Variables:

  • Exercise 6: Let & Const
  • Exercise 7: Data Types
  • Exercise 8: Temperature

Note on Exercises 9 & 10: The Codedex exercises ask for personal body measurements. In our class, we believe you shouldn't have to share personal information to learn programming concepts. The alternatives below teach the same skills β€” math with variables, formulas, and formatted output β€” using neutral data. Complete the Codedex exercises to learn the concepts, then submit these alternatives in your consolidated file.

Exercise 9: Tip Calculator (Alternative)

Create a tip calculator:

  • Store a bill amount
  • Store a tip percentage (15%, 18%, or 20%)
  • Calculate the tip amount: tipAmount = billAmount * (tipPercent / 100)
  • Calculate the total: total = billAmount + tipAmount
  • Print a formatted receipt

Exercise 10: Playlist Duration (Alternative)

Create a playlist duration calculator:

  • Store the number of songs in your playlist
  • Store the average song length in minutes (e.g., 3.5)
  • Calculate total playlist duration in minutes
  • Convert to hours and minutes
  • Output a formatted summary

Consolidating Your Work

After completing all 5 exercises on Codedex, create a single JavaScript file with all your code organized into sections.

File Name

tutorial-1-0-codedex-variables.js

File Structure

// ============================================
// TUTORIAL 1-0: CODEDEX VARIABLES
// Student: [Your Name]
// Date: [Date]
// ============================================

// --------------------------------------------
// EXERCISE 6: LET & CONST
// Create 4 variables for a user profile:
// - Two const variables (first name, favorite color)
// - Two let variables (current location, mood)
// Print them all, then reassign one let variable
// --------------------------------------------




// --------------------------------------------
// EXERCISE 7: DATA TYPES
// Create variables for your favorite company:
// - companyName (string)
// - foundingYear (number)
// - isActive (boolean)
// - fundingAmount (undefined)
// Print them all
// --------------------------------------------




// --------------------------------------------
// EXERCISE 8: TEMPERATURE
// Convert Brooklyn's temperature from Β°F to Β°C
// Formula: (fahrenheit - 32) / 1.8
// --------------------------------------------




// --------------------------------------------
// EXERCISE 9: TIP CALCULATOR
// Calculate tip and total from a bill
// - billAmount, tipPercent
// - tipAmount = billAmount * (tipPercent / 100)
// - total = billAmount + tipAmount
// --------------------------------------------




// --------------------------------------------
// EXERCISE 10: PLAYLIST DURATION
// Calculate total playlist length
// - numberOfSongs, avgSongLength (in minutes)
// - totalMinutes, hours, remainingMinutes
// Format the output nicely
// --------------------------------------------



Testing Your File

Before submitting, run your JavaScript file to make sure everything works:

Option A: Browser Console

  1. Open any browser (Chrome, Firefox, Safari)
  2. Open DevTools: Cmd + Option + I (Mac) or Ctrl + Shift + I (Windows)
  3. Click the Console tab
  4. Copy your entire .js file contents
  5. Paste into the console and press Enter

Option B: CodePen

  1. Go to codepen.io
  2. Create a new pen
  3. Paste your code in the JS panel
  4. Open the console (bottom left) to see output

What you should see:

  • Your user profile with all 4 variables
  • Updated mood after reassignment
  • Company info with different data types
  • Temperature conversion
  • Tip calculator receipt
  • Playlist duration summary

Complete Criteria

  • File is named tutorial-1-0-codedex-variables.js
  • All 5 exercise sections are present
  • Code runs without errors in browser console
  • Uses both let and const correctly
  • Includes all 4 data types (string, number, boolean, undefined)
  • Content is personalized (not just copied examples)

Common Issues

"const cannot be reassigned" You tried to change a const variable. Use let if you need to change the value later.

"NaN" (Not a Number) You're trying to do math with something that isn't a number. Check your variable values.

Tip calculation is off Remember: tipPercent / 100 converts 20 to 0.20. Don't forget the parentheses!

Hours/minutes conversion To get hours: Math.floor(totalMinutes / 60) To get remaining minutes: totalMinutes % 60 (the % is modulo β€” gives the remainder)


Resources

Learn: HTML Academy β€” Introduction to JavaScript

learn/learn-1-1-html-academy.md

Learn: HTML Academy β€” Introduction to JavaScript

Points: 10 (Complete/Incomplete) Time Estimate: 60–90 minutes Platform: HTML Academy


TL;DR

Complete HTML Academy's Chapter 2 on JavaScript. Learn the Find β†’ Listen β†’ Change pattern for interactive elements.


Submit

No submission required β€” come to Day 2 ready to discuss what clicked and what confused you.


Overview

This week's Learn activity reinforces the JavaScript fundamentals you practiced in Week 0. HTML Academy's "Introduction to JavaScript" chapter walks you through building a theme switcher β€” exactly what we'll implement in code next week.

Why HTML Academy?

  • Interactive, browser-based exercises
  • Immediate feedback on your code
  • Builds on concepts from the MDN tutorial
  • Theme switcher project connects directly to our course content

What You're Learning

By completing this tutorial, you'll practice:

  • Using querySelector to find elements
  • Adding event listeners with addEventListener
  • Changing text content with textContent
  • Working with classList to toggle states
  • Reading and writing to localStorage
  • Working with form inputs using input.value

The Tutorial

Go to HTML Academy: Introduction to JavaScript and complete Chapter 2.

Chapter 2 Topics:

  1. Why is JavaScript necessary?
  2. Introduction to the theme switcher
  3. Find an element using querySelector
  4. Output the element to the console
  5. Remove a class using classList.remove
  6. Add a class using classList.add
  7. Declare a variable
  8. Introduction to the event handler
  9. Make the theme switch when the button is clicked
  10. Introduction to classList.toggle
  11. Finish the theme switcher
  12. Introduction to the textContent property
  13. Change the textual content for the element
  14. Uncomment the code
  15. Retrieve data from the input field using input.value
  16. Use concatenation
  17. Summary

What to Focus On

As you work through the exercises, pay attention to:

The Pattern

// 1. Find the element
const element = document.querySelector('.selector');

// 2. Listen for an event
element.addEventListener('click', function() {
  // 3. Do something
  element.classList.toggle('active');
});

This Find β†’ Listen β†’ Change pattern is the foundation of interactive JavaScript.

Vocabulary to Lock In

  • querySelector β€” "Find this element"
  • addEventListener β€” "When this happens, do that"
  • classList.toggle β€” "Flip this state on/off"
  • textContent β€” "The text inside this element"
  • input.value β€” "What the user typed"

Connection to This Week

This tutorial keeps your JavaScript skills warm while we focus on design systems in Figma. Next week, you'll use these exact concepts to build a working theme toggle in your portfolio.

The sequence:

  1. Week 0: Learn the concepts (MDN tutorial)
  2. Week 1: Reinforce with practice (HTML Academy) + Design in Figma
  3. Week 2: Build it in code

If You Get Stuck

  • Re-read the instructions β€” HTML Academy gives helpful hints
  • Check your syntax β€” missing quotes, parentheses, or semicolons cause errors
  • Use the browser console β€” console.log() helps you see what's happening
  • Ask in Slack β€” your classmates might have the same question

Resources

Practice

Practice: The Story Teller

practice/practice-1-1-the-story-teller.md

Practice: The Story Teller

Points: 20 Time Estimate: 90–120 minutes


TL;DR

Create an interactive story with 5 images. Clicking advances the narrative and updates text dynamically.


Submit

  1. GitHub Pages link β€” your live, working story
  2. GitHub repo link β€” direct link to your story-teller/ folder

Overview

This is practice. You read the MDN Adding Interactivity tutorial in Week 0. You completed the exercises. Now you USE those concepts in a creative context.

Remember the event flow from Day 1:

User Action β†’ Event Listener β†’ State Change β†’ UI Updates

That's exactly what you're building here: click an image β†’ listener fires β†’ update the step β†’ change what's displayed.

Choose your theme:

  • MLK Day β€” Tell a story about civil rights, community, or service
  • Valentine's Day β€” Tell a story about connection, friendship, or love

What You're Building

A single-page interactive experience where:

  • 5 images tell a sequential story
  • Clicking an image advances the story or triggers a change
  • Text updates dynamically based on user interaction
  • (Stretch) Progress is remembered using localStorage

Requirements

Core (Required)

  1. 5 images that form a narrative sequence
  2. Click interaction β€” each image does something when clicked:
    • Advance to next part of story
    • Reveal hidden text
    • Change the image
    • Add a visual effect (class toggle)
  3. Dynamic text β€” at least one text element changes based on interaction
  4. Uses these JavaScript concepts:
    • querySelector or querySelectorAll
    • addEventListener
    • textContent or innerHTML
    • classList.add, classList.remove, or classList.toggle

Stretch Goals

  • localStorage β€” Remember which image/step the user was on
  • User input β€” Personalize the story with the user's name
  • Transitions β€” CSS transitions for smooth visual changes
  • Sound β€” Add audio that plays on interaction

Technical Specifications

File Structure

week-1/
└── story-teller/
    β”œβ”€β”€ index.html
    β”œβ”€β”€ css/
    β”‚   └── style.css
    β”œβ”€β”€ js/
    β”‚   └── script.js
    └── assets/
        └── images/
            β”œβ”€β”€ image-1.jpg
            β”œβ”€β”€ image-2.jpg
            β”œβ”€β”€ image-3.jpg
            β”œβ”€β”€ image-4.jpg
            └── image-5.jpg

HTML Structure (Example)

<main class="story-container">
  <div class="story-image">
    <img src="assets/images/image-1.jpg" alt="Story image 1" data-step="1">
  </div>

  <div class="story-text">
    <p id="story-caption">Click the image to begin...</p>
  </div>

  <div class="story-progress">
    <span class="dot active"></span>
    <span class="dot"></span>
    <span class="dot"></span>
    <span class="dot"></span>
    <span class="dot"></span>
  </div>
</main>

JavaScript Pattern

// Find elements
const image = document.querySelector('.story-image img');
const caption = document.querySelector('#story-caption');

// Story content
const captions = [
  "Click the image to begin...",
  "Chapter 1: The beginning...",
  "Chapter 2: The journey...",
  "Chapter 3: The challenge...",
  "Chapter 4: The turning point...",
  "Chapter 5: The resolution..."
];

// Track current step
let currentStep = 0;

// Listen for clicks
image.addEventListener('click', function() {
  currentStep++;

  if (currentStep < captions.length) {
    // Update caption
    caption.textContent = captions[currentStep];

    // Update image
    image.src = `assets/images/image-${currentStep + 1}.jpg`;

    // Update progress dots
    updateProgress(currentStep);
  }
});

function updateProgress(step) {
  const dots = document.querySelectorAll('.dot');
  dots.forEach((dot, index) => {
    if (index <= step) {
      dot.classList.add('active');
    } else {
      dot.classList.remove('active');
    }
  });
}

Image Sources

Free image resources:

  • Unsplash β€” High-quality free photos
  • Pexels β€” Free stock photos
  • Library of Congress β€” Historical images (great for MLK theme)
  • Your own photos or illustrations

Image guidelines:

  • Consistent aspect ratio across all 5 images
  • Optimized for web (under 500KB each)
  • Descriptive alt text for accessibility

Evaluation Criteria

Criteria Points
5 images that tell a cohesive story 4
Click interaction works correctly 4
Text updates dynamically 4
Uses required JavaScript concepts 4
Code is organized and readable 2
Visual design supports the narrative 2
Total 20

Bonus points (up to 5):

  • localStorage implementation (+2)
  • User personalization (+1)
  • CSS transitions (+1)
  • Creative/unexpected interaction (+1)

Connection to Course

This practice reinforces what you've already learned:

From Week 0:

From Week 1 Day 1:

  • Event Flow diagram (User Action β†’ Listener β†’ State β†’ UI)
  • Selector Cheatsheet (.class, #id, [data-*])

Preview of Week 2:

  • localStorage for remembering state (stretch goal)

The pattern here (click β†’ change state β†’ update UI) is the same pattern you'll use for theme toggles, accordions, and more complex interactions throughout the course.


Inspiration

You don't need to be this complex β€” but notice how they use interaction to reveal narrative.

Build

Build: Portfolio Migration

build/build-1-1-portfolio-migration.md

Build: Portfolio Migration

Points: 10 (Complete/Incomplete) Time Estimate: 30-45 minutes


TL;DR

Move your portfolio files into the standardized week-1/portfolio/ folder structure and fix any broken paths.


Submit

No separate submission. Verified in class. Push to GitHub and confirm GitHub Pages works.


Overview

Migrate your portfolio site into this week's folder structure. This establishes the project scaffold we'll use throughout the quarter and ensures your portfolio follows our standardized organization.


What You're Doing

  1. Copy your current portfolio files into week-1/portfolio/
  2. Reorganize files to match our project structure
  3. Update any broken paths: images, links, CSS, JS
  4. Verify everything works locally

Target Structure

week-1/
└── portfolio/
    β”œβ”€β”€ index.html
    β”œβ”€β”€ css/
    β”‚   β”œβ”€β”€ normalize.css
    β”‚   β”œβ”€β”€ variables.css
    β”‚   └── style.css
    β”œβ”€β”€ js/
    β”‚   └── script.js
    β”œβ”€β”€ assets/
    β”‚   β”œβ”€β”€ images/
    β”‚   β”œβ”€β”€ fonts/
    β”‚   └── icons/
    └── README.md

Step-by-Step

Step 1: Create the Folder Structure

In your repository's week-1/ folder, create:

week-1/
└── portfolio/
    β”œβ”€β”€ css/
    β”œβ”€β”€ js/
    └── assets/
        β”œβ”€β”€ images/
        β”œβ”€β”€ fonts/
        └── icons/

Step 2: Move Your Files

Copy your portfolio files into the appropriate folders:

File Type Destination
index.html, other .html files portfolio/ root
CSS files portfolio/css/
JavaScript files portfolio/js/
Images portfolio/assets/images/
Fonts portfolio/assets/fonts/
Icons/SVGs portfolio/assets/icons/

Step 3: Create Missing Files

If you do not have these files yet, create them:

normalize.css Download from necolas.github.io/normalize.css or use a CDN link.

variables.css can be empty for now

/* Design Tokens - Week 1 */
:root {
  /* Colors - to be defined */

  /* Typography - to be defined */

  /* Spacing - to be defined */
}

README.md

# Portfolio - Week 1

## Project Structure
- `css/` - Stylesheets
- `js/` - JavaScript
- `assets/` - Images, fonts, icons

## Changes This Week
- Migrated to standardized structure
- Added variables.css for design tokens

Step 4: Update Paths

After moving files, update paths in your HTML:

Before flat structure:

<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<img src="hero-image.jpg" alt="...">

After organized structure:

<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/script.js" defer></script>
<img src="assets/images/hero-image.jpg" alt="...">

Step 5: Test Locally

  1. Open index.html in your browser
  2. Check that:
    • Styles load correctly
    • Images display
    • JavaScript works if any
    • No console errors
  3. Fix any broken paths

Common Issues

Images are not showing

  • Check the path: assets/images/filename.jpg
  • Verify the filename matches exactly and is case-sensitive

CSS is not loading

  • Check link order: normalize, variables, style
  • Verify paths start from the HTML file's location

JavaScript errors

  • Add defer to your script tag
  • Check the console for specific errors

Complete Criteria

Your migration is complete when:

  • Folder structure matches the target
  • All files are in correct locations
  • variables.css exists even if empty
  • README.md exists with basic info
  • Site loads without errors locally
  • Committed to GitHub with a descriptive message

Connection to This Week

This structure sets up your portfolio for the design system work we're doing this week:

  • variables.css will hold your design tokens
  • The organized structure matches professional projects
  • Next week, you will add JavaScript to js/script.js for the theme toggle

Reflect

Reflect: Visual Notes β€” Design Systems

reflect/reflect-1-1-visual-notes.md

Reflect: Visual Notes β€” Design Systems

Points: 10 (Complete/Incomplete) Time Estimate: 30–45 minutes


TL;DR

Create a page of hand-drawn visual notes capturing key design systems concepts from this week.


Submit

  1. Scan your pages using a document scanner or scanning app
  2. Create a single PDF file (right-reading order)
  3. Name your file: week-1-notes-lastname.pdf
  4. Upload to Canvas by Sunday at midnight

Overview

Create a page of hand-drawn visual notes that capture the key concepts from this week's design systems content. Visual note-taking helps you process and remember information differently than typing.


What to Capture

Based on this week's readings and lectures, your visual notes should include:

Required Concepts

  1. Design System Hierarchy

    • Design System β†’ Pattern Library β†’ Style Guide
    • What belongs at each level?
  2. Design Tokens

    • What is a token?
    • Primitives vs. Semantic tokens
    • Example: blue-500 vs. action-primary
  3. The Token Pipeline

    • Figma Variables β†’ JSON β†’ CSS Custom Properties
    • How design decisions travel to code
  4. Token Naming

    • Why semantic names matter
    • What happens when brand colors change?

Optional (Pick 1-2)

  • Atomic Design (atoms, molecules, organisms)
  • CSS Custom Properties syntax
  • Light/dark mode architecture
  • Accessibility considerations

Focus Questions

As you take notes, consider these questions:

  1. What is a design system, and how does it differ from a style guide or pattern library? (Draw the hierarchy)

  2. What are design tokens, and why do we use semantic names like action-primary instead of blue-500?

  3. How do primitives and semantic tokens work together? (Sketch an example of how one color value flows through both layers)

  4. What problem does a design system solve? (Think about what happens when a brand changes its primary color across 50 screens)


Format

Pages: 2-4 pages (5.5" Γ— 8.5" each) Medium: Moleskine Cahier notebook (or similar) Tools: Pen (any color that scans well) Style: Hand-written with visual elements (sketches, diagrams, connections)

Visual Note Techniques

  • Icons & symbols β€” Represent concepts visually
  • Containers & frames β€” Group related ideas
  • Arrows & connectors β€” Show relationships
  • Typography hierarchy β€” Big = important
  • Color coding β€” Optional but helpful
  • Sketches β€” Quick drawings of interfaces

Examples of Good Visual Notes

Your notes might include:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DESIGN TOKENS                       β”‚
β”‚  ─────────────────                   β”‚
β”‚                                      β”‚
β”‚  [Primitive]     β†’    [Semantic]     β”‚
β”‚  blue-500             action-primary β”‚
β”‚  #0066CC              ↓              β”‚
β”‚                       button-bg      β”‚
β”‚                                      β”‚
β”‚  "Raw values"    "Meaningful names"  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Or a flow diagram:

Figma Variables
      ↓
   JSON/Data
      ↓
CSS Custom Properties
      ↓
Components use vars

Complete Criteria

Your visual notes are complete when:

  • 2-4 pages with genuine engagement
  • Covers the 4 required concepts
  • Uses visual elements (not just text)
  • Legible and organized
  • Captures your understanding, not copied definitions

Grading

This is Complete/Incomplete. You get full credit for genuine engagement with the material. We're looking for evidence of thinking, not artistic perfection.

Complete: Shows effort to understand and visualize concepts Incomplete: Missing concepts, only text, or clearly rushed


Why Visual Notes?

Research shows that visual note-taking:

  • Improves retention over typing
  • Forces you to synthesize information
  • Creates memorable mental models
  • Becomes a personal reference document

These notes are for YOU. They'll help when you're coding your design system and can't remember the difference between primitives and semantic tokens.


Required Reading

Choose one:

OR

AND (required):


Inspiration

For visual note-taking techniques and examples:

Resources

Event Flow Diagram

resources/event-flow-diagram.md

Event Flow Diagram

How user actions become visual changes.


The Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                                 β”‚
β”‚   USER CLICKS BUTTON                                            β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚   β”‚  BROWSER DETECTS CLICK EVENT        β”‚                       β”‚
β”‚   β”‚  "Something happened on this        β”‚                       β”‚
β”‚   β”‚   element!"                         β”‚                       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚   β”‚  JAVASCRIPT EVENT LISTENER RUNS     β”‚                       β”‚
β”‚   β”‚  The function inside addEventListenerβ”‚                       β”‚
β”‚   β”‚  executes NOW                       β”‚                       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚   β”‚  JAVASCRIPT CHANGES THE STATE       β”‚                       β”‚
β”‚   β”‚  document.documentElement           β”‚                       β”‚
β”‚   β”‚    .setAttribute('data-theme',      β”‚                       β”‚
β”‚   β”‚     'dark')                         β”‚                       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚   β”‚  CSS SELECTOR NOW MATCHES           β”‚                       β”‚
β”‚   β”‚  [data-theme="dark"] { ... }        β”‚                       β”‚
β”‚   β”‚  becomes active                     β”‚                       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚   β”‚  BROWSER REPAINTS                   β”‚                       β”‚
β”‚   β”‚  Colors, fonts, etc. update         β”‚                       β”‚
β”‚   β”‚  visually on screen                 β”‚                       β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
β”‚         β”‚                                                       β”‚
β”‚         β–Ό                                                       β”‚
β”‚   USER SEES THE CHANGE                                          β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

In Code

// 1. Find the button
const toggle = document.querySelector('.theme-toggle');

// 2. Listen for clicks
toggle.addEventListener('click', function() {

  // 3. Change the state (this triggers CSS to respond)
  document.documentElement.setAttribute('data-theme', 'dark');

});
/* 4. CSS responds to the new state */
[data-theme="dark"] {
  --color-surface: #1a1a1a;
  --color-text: #f0f0f0;
}

/* 5. Elements using these variables automatically update */
body {
  background: var(--color-surface);
  color: var(--color-text);
}

The Key Insight

JavaScript doesn't change colors directly.

Instead:

  1. JavaScript changes an attribute or class
  2. CSS has rules that match that attribute/class
  3. The browser applies those CSS rules
  4. The visual updates

This separation is powerful:

  • JavaScript handles what state we're in
  • CSS handles how that state looks
  • You can change the look without touching JavaScript

Common Pattern

USER ACTION  β†’  JS UPDATES STATE  β†’  CSS RESPONDS  β†’  VISUAL CHANGE
   click          data-theme          [data-theme]     colors update
   hover          classList.add       .active          show/hide
   scroll         setAttribute        [data-visible]   animate in

Why This Matters

When debugging, ask:

  1. Is the event firing? (Add console.log in listener)
  2. Is the state changing? (Check Elements panel for attribute/class)
  3. Is CSS responding? (Check if your selector matches)

The problem is usually in one of these three places.

querySelector Selector Cheatsheet

resources/selector-cheatsheet.md

querySelector Selector Cheatsheet

This is your reference for finding elements in JavaScript.


The Pattern

// Find ONE element
const element = document.querySelector('selector');

// Find ALL matching elements
const elements = document.querySelectorAll('selector');

Selector Types

By Tag Name

<button>Click me</button>
<p>Some text</p>
document.querySelector('button')    // β†’ <button>Click me</button>
document.querySelector('p')         // β†’ <p>Some text</p>

By Class (use a dot .)

<button class="theme-toggle">Toggle</button>
<button class="primary">Submit</button>
document.querySelector('.theme-toggle')  // β†’ <button class="theme-toggle">
document.querySelector('.primary')       // β†’ <button class="primary">

Common mistake:

document.querySelector('theme-toggle')   // ❌ Returns null! (forgot the dot)
document.querySelector('.theme-toggle')  // βœ… Correct

By ID (use a hash #)

<header id="main-header">...</header>
<section id="about">...</section>
document.querySelector('#main-header')   // β†’ <header id="main-header">
document.querySelector('#about')         // β†’ <section id="about">

By Data Attribute (use brackets [])

<button data-theme="light">Light</button>
<button data-theme="dark">Dark</button>
<div data-visible="true">...</div>
document.querySelector('[data-theme]')           // β†’ First element with data-theme
document.querySelector('[data-theme="dark"]')    // β†’ The dark theme button
document.querySelector('[data-visible="true"]')  // β†’ The div

Combined Selectors

<button class="btn primary">Submit</button>
<button class="btn secondary">Cancel</button>
// Element with multiple classes
document.querySelector('.btn.primary')    // β†’ <button class="btn primary">

// Element type with class
document.querySelector('button.primary')  // β†’ Same result

querySelector vs querySelectorAll

Method Returns Use When
querySelector First match (or null) You want ONE element
querySelectorAll NodeList of ALL matches You want MULTIPLE elements
<button class="theme-btn">Light</button>
<button class="theme-btn">Dark</button>
<button class="theme-btn">System</button>
// Get just the first one
const firstBtn = document.querySelector('.theme-btn');
// β†’ <button class="theme-btn">Light</button>

// Get all of them
const allBtns = document.querySelectorAll('.theme-btn');
// β†’ NodeList(3) [button, button, button]

// Loop through all of them
allBtns.forEach(btn => {
  btn.addEventListener('click', () => {
    console.log('Clicked:', btn.textContent);
  });
});

What Does null Mean?

If querySelector returns null, it means nothing matched.

const toggle = document.querySelector('.theme-toggle');
console.log(toggle);  // null = element not found!

Debugging checklist:

  1. Did you spell the selector correctly?
  2. Did you include the . for classes or # for IDs?
  3. Does the element exist in your HTML?
  4. Is your script running before the HTML loads? (Add defer to script tag)

DevTools Trick

Copy a selector directly from DevTools:

  1. Right-click an element in the page
  2. Click Inspect
  3. In Elements panel, right-click the highlighted element
  4. Click Copy β†’ Copy selector
  5. Paste into your JavaScript

Quick Reference

HTML JavaScript Selector
<button> 'button'
<div class="card"> '.card'
<header id="top"> '#top'
<button class="btn primary"> '.btn.primary'
<input type="text"> 'input[type="text"]'
<div data-theme="dark"> '[data-theme="dark"]'
All paragraphs querySelectorAll('p')

See Also

Week 1 Resources: Systems That Respond

resources/week-1-resources.md

Week 1 Resources: Systems That Respond

Topics: CSS Variables, Design Tokens, Theme Switching, DOM Basics, querySelector, addEventListener


Assigned (Required)

Complete these before class:

Technical Tutorial

Conceptual Reading


Reference (Lookup, Not Reading)

MDN documentation for when you need the exact syntax:


Video

Essential (Watch These)

Recommended

Hidden Gems


Deep Dive (Articles & Essays)

Design Systems

Dark Mode & Preferences

Hidden Gems (Articles)


Tools

Playgrounds

  • CodePen β€” Quick experiments, easy to share
  • JSFiddle β€” Another option, good for JS focus
  • StackBlitz β€” Full IDE in browser, good for larger experiments

Color Tools

  • Realtime Colors β€” Preview your color palette on a real layout

    • Hidden gem. Paste your tokens and see how they look immediately.
  • Coolors β€” Generate color palettes

  • Contrast Checker β€” WebAIM accessibility checker

  • Who Can Use β€” See your colors through different vision types

Token Systems

  • Open Props β€” Ready-made CSS custom properties

    • See how a mature token system is organized. Use as reference or scaffold.
  • Pollen β€” Minimal CSS variables library

    • Simpler than Open Props. Good inspiration for your own system.

DevTools


Inspiration

Real-world examples of theme systems:

Excellent Implementations

  • Stripe.com β€” Toggle in footer, beautiful transitions
  • Josh Comeau's Blog β€” Animated sun/moon toggle, playful
  • MDN Web Docs β€” Theme picker in header
  • GitHub β€” Multiple themes (light, dark, auto, high contrast)
  • Vercel β€” Clean system preference detection

Design System References

Student-Level Examples


Books (Optional, Quarter-Long)

These are references, not required reading:

  • Design Systems by Alla Kholmatova (Smashing Magazine)

    • The definitive book on design systems. Read a chapter at a time.
  • Laying the Foundations by Andrew Couldwell

    • Practical design system implementation. Good for project planning.
  • Refactoring UI by Adam Wathan & Steve Schoger

    • Design advice for developers. Helps with token decisions.

Week 1 Cheat Sheet

/* Define tokens */
:root {
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
}

/* Use tokens */
body {
  background: var(--color-surface);
  color: var(--color-text);
}

/* Override for dark mode */
body.dark {
  --color-surface: #1a1a1a;
  --color-text: #f0f0f0;
}
// Find the button
const toggle = document.querySelector('.theme-toggle');

// Listen for clicks
toggle.addEventListener('click', function() {
  // Toggle the class
  document.body.classList.toggle('dark');
});

Next Week Preview

Week 2 adds:

  • localStorage β€” remembering user choice
  • prefers-color-scheme detection in JavaScript
  • prefers-reduced-motion β€” respecting accessibility preferences

Walkthrough

Week 1 Instructor Walkthrough

WEEK-1-WALKTHROUGH.md

Week 1 Instructor Walkthrough

A step-by-step guide to verify everything works before teaching.


Pre-Class: Verify Everything Works

Step 1: Figma Setup

Verify access to:

Test these in Figma:

Test Expected Result
Create a variable Variable appears in Local Variables panel
Create a collection Collection with modes available
Apply variable to fill Variable icon appears in fill, not hex value
Switch modes Colors change when mode switches

Step 2: Demo Files

CSS Variables Intro:

curriculum/weeks/week-1/demos/css-variables-intro.html
  • Page loads
  • Demonstrates :root variables

Prefers Color Scheme:

curriculum/weeks/week-1/demos/prefers-color-scheme.html
  • Page loads
  • Responds to system dark mode preference

Step 3: Resources & Links

Verify external links work:


Day 1: The Structure of Design (Revised)

Before Students Arrive

  • VS Code open with example project structure
  • Browser with design system examples ready (Spectrum, Material, Primer)
  • Event flow diagram ready to display
  • Learning log template displayed or linked
  • normalize.css ready to show (necolas.github.io/normalize.css)

Delivery Sequence

1. Opening: Learning Log (15 min)

Students update their learning log (README.md) with reflections on Week 0.

Display the template:

## Week 1

### What I Learned
### What Was Hard
### How I Used AI
### What's Still Unclear

### Work Completed (Week 0)
- [ ] Engage: Portfolio Audit
- [ ] Learn: Console Explorer
- [ ] Learn: Codedex Console Fundamentals
- [ ] Reflect: Visual Notes
- [ ] Build: The Setup
- [ ] Build: The Behavioral Layer

Instructions:

  1. Open portfolio repo in VS Code
  2. Edit README.md (create if needed)
  3. Add Week 1 section
  4. Fill in reflections + check off completed work
  5. Commit and push

While they work: Walk around, answer questions, check who's struggling with Git.


2. Project Structure (25 min)

Show the standardized folder structure:

/project-name/
β”œβ”€β”€ index.html
β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ normalize.css   ← browser reset
β”‚   β”œβ”€β”€ variables.css   ← design tokens (later)
β”‚   └── style.css       ← your styles
β”œβ”€β”€ js/
β”‚   └── script.js
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ images/
β”‚   β”œβ”€β”€ fonts/
β”‚   └── icons/
└── README.md

Key points:

  • normalize.css β†’ variables.css β†’ style.css (order matters)
  • Separation of concerns
  • This structure grows with the project

Normalize/Reset intro:

  • "Browsers have opinions. They don't agree."
  • Different browsers render elements differently
  • normalize.css resets them to a consistent baseline
  • "You don't write this file. You download it and include it."
  • Show: necolas.github.io/normalize.css

3. Design Systems Intro (20 min) β€” LIGHTER VERSION

Draw on whiteboard:

Design System (biggest)
    └── Pattern Library
        └── Style Guide (what we're building)

Keep it brief:

  • Style Guide: Colors, typography, spacing
  • Pattern Library: Reusable components
  • Design System: The complete package

Show briefly: Spectrum, Material, Primer

  • "These teams have hundreds of engineers. Why do they invest in this?"

Bridge statement:

"The way design systems solve this problem is with variables β€” named values that can change. Figma has them. CSS has them. JavaScript can control them. That's what this quarter is about: connecting all three."

Figma Variables  ←→  CSS Custom Properties  ←→  JavaScript
     ↑                      ↑                      ↑
  (design)              (styling)              (behavior)

"Day 2, we'll get into the details. Today, just know this connection exists."


4. Event Flow (15 min)

"Let's reinforce what you learned in Week 0 about JavaScript."

Walk through the diagram slowly:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Action   β”‚  ← click, hover, keypress
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Event Listener β”‚  ← addEventListener
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  State Change   β”‚  ← classList.toggle
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   UI Updates    β”‚  ← CSS responds to new class
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key insight: "JavaScript doesn't change colors directly. It changes state. CSS responds to state."

This is exactly what you'll do in the Story Teller practice.


5. Selector Cheatsheet (15 min)

"You used these in Week 0. Let's make sure you know where to look."

Selector Example What it finds
.class .story-image Elements with that class
#id #story-caption The one element with that ID
[data-*] [data-step="1"] Elements with that attribute

Once you find an element, what can you do?

  • Change its text: element.textContent = 'New text'
  • Add/remove classes: element.classList.add('active') or .remove() or .toggle()

"You saw these in the MDN tutorial. For Story Teller, you'll use them to update captions and progress dots."

DevTools trick: Right-click β†’ Inspect β†’ Right-click element β†’ Copy β†’ Copy selector

Common mistake: Forgetting the dot (.story-image not story-image)

"You don't need to memorize this. You need to know where to look."


6. Closing: Assignments (10 min)

Assign:

  1. Build 1-1: Portfolio Migration

    • Restructure portfolio to follow project structure
    • Due before Day 2
  2. Learn 1-0: Codedex Variables

    • Exercises 6-10 on codedex.io/javascript
    • Covers let, const, data types, math with variables
    • Due before Day 2
  3. Learn 1-1: HTML Academy Chapter 2

    • Theme switcher tutorial
    • Due before Day 2
  4. Learn 1-2: Figma Variables Tutorial

Remind: Engage activity (VS Code Theme Setup) if not done


Day 2: Figma Variables + Workshop

Before Students Arrive

  • Figma open with blank file for demo
  • Style guide template ready to share
  • Learning log questions displayed

Delivery Sequence

1. Learning Log Check-In (15 min)

Display questions:

  1. What did you learn since last class?
  2. What was hard?
  3. How did you use AI this week?
  4. What is still giving you issues?

5 minutes writing, then share with a neighbor.

2. Figma Variables Deep Dive (20 min)

[LIVE DEMO: Create Primitives Collection]

  1. Open Local Variables panel
  2. Create collection β†’ "Primitives"
  3. Create color variables:
    colors/blue/500    #0066CC
    colors/blue/600    #0052A3
    colors/gray/100    #F5F5F5
    colors/gray/900    #1A1A1A
    
  4. Create spacing variables:
    spacing/xs         4
    spacing/sm         8
    spacing/md         16
    spacing/lg         24
    

Key points:

  • Use / for hierarchy (creates folders)
  • Be consistent with naming
  • Primitives are raw values β€” no modes yet

[LIVE DEMO: Create Semantic Collection]

  1. Create new collection β†’ "Semantic"
  2. Add a mode: Light (default), then add Dark mode
  3. Create variables that reference primitives:

Light Mode:

surface/primary      β†’ {Primitives/colors/white}
text/primary         β†’ {Primitives/colors/gray/900}
action/primary       β†’ {Primitives/colors/blue/500}

Dark Mode:

surface/primary      β†’ {Primitives/colors/gray/900}
text/primary         β†’ {Primitives/colors/white}
action/primary       β†’ {Primitives/colors/blue/400}

3. Apply Variables to Frame (10 min)

  1. Select a frame
  2. In fill, click the variable icon
  3. Choose semantic variable
  4. Switch modes in the layer panel
  5. Watch colors change automatically

The magic moment: Everything updates when you switch modes.

4. Token Naming Exercise (10 min)

Show a UI and have students suggest token names:

  • The background of a card β†’ surface/secondary?
  • The text on a button β†’ text/on-action?
  • The border of an input β†’ border/input?
  • The hover state of a link β†’ action/primary-hover?

Nathan Curtis naming pattern: category/property/variant

5. Break (10 min)

6. Workshop Time (45 min)

Students work on Build 1-2: The Foundation

Their task:

  1. Audit existing colors from portfolio
  2. Create a Primitives collection
  3. Create a Semantic collection with Light/Dark modes
  4. Build a style guide frame

Circulate and check for:

  • Are they using semantic names or just "color1, color2"?
  • Do their semantic tokens reference primitives?
  • Have they set up both modes?
  • Are variables actually applied (not hardcoded colors)?

7. Closing (10 min)

Progress check (show of hands):

  • Who has primitives set up?
  • Who has semantic variables with modes?
  • Who got mode switching to work?

Weekend assignments:

  • Build 1-2: The Foundation (complete style guide)
  • Practice 1-1: The Story Teller (creative JavaScript)
  • Reflect 1-1: Visual Notes (design systems concepts)

Preview Week 2: "Next week, we translate this Figma system into CSS. Your variables.css file will mirror what you built today. Then we add JavaScript to toggle between modes."


Quick Reference: Key Paths

Resource Path from week-1/
CSS Variables Demo demos/css-variables-intro.html
Prefers Color Scheme Demo demos/prefers-color-scheme.html
Engage 1-1 engage/engage-1-1-vscode-theme-setup.md
Engage 1-2 engage/engage-1-2-learning-log.md
Learn 1-0 learn/learn-1-0-codedex-variables.md
Learn 1-1 learn/learn-1-1-html-academy.md
Learn 1-2 learn/learn-1-2-figma-variables.md
Practice 1-1 practice/practice-1-1-the-story-teller.md
Build 1-1 build/build-1-1-portfolio-migration.md
Build 1-2 build/build-1-2-the-foundation.md
Reflect 1-1 reflect/reflect-1-1-visual-notes.md
Resources resources/week-1-resources.md

External Resources (Verify Links)

Assigned Reading:

Figma Resources:

Reference:

Video:


If Things Go Wrong

Figma Variables panel not showing:

  • View β†’ Local Variables
  • Or click the variable icon in the right sidebar

Variables aren't showing when applying:

  • Make sure variable is scoped to the property (fill, stroke, etc.)
  • Check collection is published to the file

Mode switching doesn't work:

  • Variables must be applied, not hardcoded
  • Frame needs to be set to use that collection's mode

Students don't know what colors to use:

  • Start with what's in their portfolio
  • Use OpenProps as reference for values
  • Aim for 3-5 colors, not 20

Design systems feels abstract:

  • Ground it in pain: "You have 47 different blues. How do you fix this?"
  • Show before/after of messy code cleaned with tokens

Files to Have Open

Day 1

  1. VS Code (project structure example)
  2. Browser with design system examples (Spectrum, Material, Primer)
  3. Event flow diagram
  4. normalize.css website
  5. Build 1-1 brief

Day 2

  1. Figma (blank file for live demo)
  2. Style guide template
  3. Build 1-2 brief
  4. Learning log questions displayed

Week 0 β†’ Week 1 β†’ Week 2 Progression

Week 0 Week 1 Week 2
Console exploration Design tokens in Figma Design tokens in CSS
Reading code Building style guides Writing JavaScript
Understanding DevTools Understanding systems Implementing systems
Any website Their portfolio (design) Their portfolio (code)

Week 1 is the design bridge: "Plan it in Figma before you code it."

Details

desn378-wk 1

desn378-wk-1-details.md

desn378-wk 1

Week 1: Systems That Respond

Interaction Question: How does it adapt to me?

Technical Focus: DOM basics, querySelector, addEventListener, CSS variables, prefers-color-scheme

By End of Week: Students have a working theme toggle, started their token system, and understand how JavaScript can respond to user interaction.


Day 1: Lecture Day

Opening Hook (15 min)

Start with the browser, not the theory.

Demo: The browser knows things

  • Open any site with dark mode support (or your own demo page)
  • Toggle system dark mode preference
  • Page adapts. No refresh. No reload.
  • "The system knew. How?"

Console exploration:

window.matchMedia('(prefers-color-scheme: dark)').matches
  • Toggle system preference, run again
  • "This is an APIβ€”a way to ask the browser questions."

Concept: CSS Variables as Design Tokens (20 min)

Show the problem:

  • Page with colors hardcoded in multiple places
  • "What if we need to change the blue? Find and replace 47 times?"

Show the solution:

  • Refactor to CSS custom properties
:root {
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-accent: #0066cc;
}

body {
  background: var(--color-surface);
  color: var(--color-text);
}
  • Change one variable, everything updates
  • "Tokens are design decisions stored in one place."

Connect to Figma:

  • "You've used variables in Figma. Same idea, in code."
  • "Tonight's reading explains why this matters at scale."

Demo: CSS Responds to Preference (15 min)

@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #1a1a1a;
    --color-text: #f0f0f0;
  }
}
  • Toggle system preference β†’ page adapts
  • "Zero JavaScript. CSS alone can respond to user preference."

Pause: "But what if the user wants to override their system setting?"

Break (10 min)

Demo: JavaScript Enters (40 min)

Live code a theme toggle, one step at a time.

Step 1: Find the button

const toggle = document.querySelector('.theme-toggle');
console.log(toggle);
  • Run it. Does it find the element?
  • Break it: typo in selector. What happens?
  • Fix it.

Step 2: Listen for clicks

toggle.addEventListener('click', function() {
  console.log('clicked!');
});
  • Run it. Click. Check console.
  • "addEventListener means: when this happens, do that."

Step 3: Toggle a class

toggle.addEventListener('click', function() {
  document.body.classList.toggle('dark');
});
  • Run it. Click. Check Elements panelβ€”class appears/disappears.
  • "classList.toggle: add if missing, remove if present."

Step 4: CSS responds to the class

body.dark {
  --color-surface: #1a1a1a;
  --color-text: #f0f0f0;
}
  • Now the toggle actually changes colors.

Key concepts to land:

  • querySelector = "find this thing"
  • addEventListener = "when this happens, do that"
  • classList.toggle = "flip this state"
  • The DOM is liveβ€”you can change it

Closing: Assignments (15 min)

Frame the work:

  • "By Day 2, you'll have built this yourself and read about why systems like this matter."

Assign:

  1. Technical Tutorial (do first)
  2. Lab 1-1: "The Switch"
    • Build a working light/dark toggle
    • Due before Day 2
  3. Visual Notes: Design Systems
    • Read and take notes on the readings
    • Due before Day 2
    • Come ready to discuss

Show Project 1 brief ("The System")

  • Due end of Week 2
  • "Everything this week builds toward this."

Day 2: Practice Day

Opening: What Did You Learn? (25 min)

Technical check-in (5 min):

  • "How'd the MDN tutorial go?"
  • "What clicked? What confused you?"
  • Quick show of hands: who got their toggle working?

Design systems discussion (20 min):

  • "What stuck with you from the Figma article?"
  • "What's the difference between a style guide and a design system?"
  • Draw out key ideas on whiteboard:
    • Consistency
    • Efficiency
    • Shared language
    • Single source of truth
  • "How does this connect to what we built yesterday?"

Backfill: Common Issues (20 min)

Address what broke:

Script loading:

  • Where does <script> go?
  • The defer attribute
  • "If your code runs before the HTML exists, it can't find anything."

Selector typos:

  • Class vs ID (.theme-toggle vs #theme-toggle)
  • Missing the dot
  • Use DevTools: right-click β†’ Copy β†’ Copy selector

Reading console errors:

  • Every error has a line number
  • "Cannot read property of null" = querySelector found nothing
  • Demo finding and fixing an error

Token Naming Exercise (20 min)

Setup:

  • Show a design with 5 colors and 3 spacing values
  • "Name these tokens. Write them down."

Compare:

  • Pair up, compare names
  • Did you choose --color-blue or --color-primary?
  • Did you choose --spacing-1 or --space-sm?

Discuss:

  • Semantic vs literal naming
  • "What happens to --color-blue when your brand changes to green?"
  • Reference the books: Kholmatova and Couldwell both address this
  • "Your system should be readable by future-you."

Break (10 min)

Structured Work Time (50 min)

For students still working on Lab 1-1:

  • Finish the toggle
  • Circulate, troubleshoot

For students who finished:

  • Start Lab 1-2: Apply to your portfolio
  • Create variables.css file
  • Begin refactoring existing CSS to use tokens

Check-in points while circulating:

  • Does clicking do anything? β†’ Check console
  • Does the class appear? β†’ Check Elements panel
  • Do colors change? β†’ Check CSS specificity

Closing (15 min)

Token system setup:

  • Show file structure: where does variables.css live?
  • Start minimal: 3-5 color tokens, 3 spacing tokens
  • "This file grows all quarter. Don't over-engineer now."

Show Open Props:

  • open-props.style
  • "One example of a mature token system. Notice their naming."
  • "You're building your own, but this shows what's possible."

Preview Week 2:

  • localStorage (remembering the user's choice)
  • prefers-reduced-motion (respecting accessibility preferences)

Remind:

  • Lab 1-2 due Sunday
  • Project 1 due end of Week 2

Labs & Assignments

Lab 1-1: "The Switch"

10 points Β· Complete/Incomplete Β· Due before Day 2

Build a working light/dark toggle:

  1. Create a button with class theme-toggle
  2. Write JS that toggles class dark on the <body> when clicked
  3. Write CSS that changes at least 3 variables when .dark is present
  4. Test: clicking should visibly change the page

Complete:

  • Button exists and is clickable
  • Class toggles on body (visible in DevTools)
  • Colors change visibly
  • No console errors

Stretch:

  • Add a transition so colors fade instead of snap
  • Change the button text/icon based on current mode
  • Add more than 3 tokens

Lab 1-2: "The Inheritance"

10 points Β· Complete/Incomplete Β· Due Sunday

Apply the theme toggle pattern to your existing portfolio:

  1. Create a variables.css file with your brand tokens
  2. Refactor at least one page to use these tokens
  3. Add a theme toggle that works

Complete:

  • variables.css exists with at least 5 tokens
  • One page uses the tokens
  • Toggle works

Stretch:

  • Add @media (prefers-color-scheme: dark) as fallback
  • Apply tokens to multiple pages

Visual Notes: Design Systems

10 points Β· Complete/Incomplete Β· Due before Day 2

(See separate Visual Notes assignment document)

This week's readings:

  1. Design Systems 101 β€” Figma blog
  2. Intro to Design Systems β€” Figma course (Overview + Foundations lessons)

Focus questions:

  • What's the difference between a style guide and a design system?
  • What problems do design systems solve (and for whom)?
  • How do tokens create a "single source of truth"?

Resources

Assigned This Week

Technical:

Conceptual:

Reference

Quarter-Long References (Books)

  • Design Systems by Alla Kholmatova
  • Laying the Foundations by Andrew Couldwell

Tutorials to Record

  1. "Finding Things with querySelector" (5 min)
    • Demystify selectors, common mistakes
    • When querySelector vs querySelectorAll
  2. "Reading Console Errors" (5 min)
    • Every error has a line number
    • Common errors and what they mean
  3. "Tokens: From Figma to CSS" (8 min)
    • Export Figma variables
    • Translate to CSS custom properties
    • Show the parallel

Alternatives

If the toggle doesn't land:

Simplify:

  • Just CSS first: spend more time on prefers-color-scheme without JS
  • Smaller demo: toggle one element's color, not the whole page

Reframe:

  • "The browser already knows how to do this. JS just gives users an override."

Different metaphor:

  • Light switch (binary) vs dimmer (spectrum)
  • We're building a light switch. Dimmers come later.

If selectors are confusing:

  • Interactive exercise: "I describe something, you write the selector"
  • Use DevTools: right-click β†’ Copy β†’ Copy selector
  • Emphasize: "Same selectors you know from CSS"

If design systems feels too abstract:

  • Start with pain: "You have 47 different blues. How do you fix this?"
  • Show before/after of messy code cleaned with tokens
  • Connect to their own 368 work: "How many places did you write the same hex code?"

Suggestions

Portfolio Enhancement

  • The toggle becomes a permanent feature
  • Week 2 adds persistenceβ€”users won't re-choose each visit
  • Consider placement: nav? footer? floating?

Going Deeper

  • Research: How do Radix or Shoelace handle theming?
  • Explore: What else does window.matchMedia know?
  • Add a third theme (high contrast)

Connection to Later Weeks

  • Week 2: localStorage keys (naming matters here too)
  • Week 3: SVG tokens for icon colors
  • Week 5+: Motion tokens (duration, easing)

Open Questions

  1. Portfolios: Are these GitHub Pages deploys from 368, or fresh starters? Affects Lab 1-2 setup.
  2. Books: Physical copies available in library? Or should these be optional purchase?
  3. Lab timing: Is "due before Day 2" realistic for reading + tutorial + lab? Could split: tutorial + lab before Day 2, visual notes by Sunday.

Resources:

https://alistapart.com/article/javascript-for-web-designers/