Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Fundamentals

What you will learn

  • Explain what a design gives a developer before any page is coded
  • Write a design prompt for an AI design tool in Role, Context, Task and Format
  • Unzip the downloaded src folder and tell which files matter
  • Read App.tsx state and BlogCard props to see what each post needs to store

Before you start

  • A working blog app (Django, FastAPI or Flask)
  • Basic HTML

The AI agent has built a blog that works. Nobody has decided yet how it should look. That's this step: get a design first, and let the code follow it.

This lecture is shared by the Django, FastAPI and Flask tracks, because the design is the same for all three. Only the last step differs: what the agent later turns the design into.

What a design gives you

Before a new dish goes on the menu, the chef plates it once and takes a photo. Now every cook knows what it should look like and where each thing sits on the plate. Without that photo, each cook would plate it their own way.

A design does the same for a web page. It shows the layout (where the header, the posts and the footer sit), the colours and fonts, and the pieces that repeat, like a post card, so they look the same everywhere. You and the agent both build towards the same picture, so nobody has to guess.

A design from a prompt

You don't have to draw it yourself. An AI design tool can build one from a prompt. The lecture used Figma Make, with a sample prompt in Role, Context, Task and Format:

PartWhat it says
RoleYou're a web designer.
ContextA simple blog, with posts in a few categories.
TaskDesign a home page with one featured post and a grid of recent posts, and a page to read a single post.
FormatA clean look, with a header, a search box and a footer.

Then look at the result like a reviewer. Is the title easy to read? Is there a way back to the list? If something's off, ask for the change in plain words and look again. When you're happy with it, it's ready to download.

Download and unzip

In the design tool, choose the option to download the code. You get one zip file, src.zip. Put it in a project folder and open that folder in PyCharm. Any unzip tool works; Python's own zipfile module does it from the terminal:

python -m zipfile -e src.zip src

It prints nothing, and that means it worked. An src folder appears next to the zip, with 57 files in it. To look inside the zip without extracting, use -l:

python -m zipfile -l src.zip
File Name                                             Modified             Size
app/App.tsx                                    2026-04-28 19:58:46        10734
app/components/ui/use-mobile.ts                2026-04-28 19:58:46          585
app/components/ui/tooltip.tsx                  2026-04-28 19:58:46         1897
...

What's inside

The src folder has app and styles. In app: App.tsx, the page; components with BlogCard.tsx and BlogPost.tsx; and a ui folder with 48 ready-made pieces that App.tsx never imports. In styles: theme.css with the colours as named values, plus fonts, globals, index and tailwind CSS. src/ app/ styles/ App.tsx the page itself BlogCard.tsx one post in the list BlogPost.tsx read one post components/ui/ 48 ready-made pieces not imported by App theme.css colours as named values The files that matter: the page, its two blog pieces, and the styles.
The downloaded src folder. Only a few of the 57 files matter for the blog.

There are two folders, app and styles. The files in app end in .tsx: React with TypeScript, the code of a web page. You don't have to write it. You only need to know what each file is for.

  • App.tsx is the page itself.
  • In components, BlogCard is one post in the list, and BlogPost is the page where you read a single post.
  • The ui folder holds 48 ready-made pieces, like a button, a card and a dialog.
  • styles holds the look. theme.css keeps the colours as named values, so --background, for example, is #ffffff.

Now look at the imports at the top of App.tsx:

import { useState } from 'react';
import { BlogCard } from './components/BlogCard';
import { BlogPost } from './components/BlogPost';
import { Search, Sparkles } from 'lucide-react';

It brings in BlogCard, BlogPost and two icons, and none of the ui pieces. That's how you know which files to read first.

The page: App.tsx

Near the top there's a list called blogPosts with five sample posts written right into the file. Each one follows this shape:

interface BlogPostData {
  id: number;
  title: string;
  excerpt: string;
  content: string;
  author: string;
  date: string;
  readTime: string;
  category: string;
}

The page keeps one piece of state:

const [selectedPost, setSelectedPost] = useState<BlogPostData | null>(null);

It starts out empty, so you see the list. Here's the part of the page that decides what to draw (shortened: most props and the wrapper elements are left out):

{selectedPost ? (
  <BlogPost
    title={selectedPost.title}
    content={selectedPost.content}
    ...
    onBack={() => setSelectedPost(null)}
  />
) : (
  <>
    <BlogCard ... onClick={() => setSelectedPost(blogPosts[0])} featured={true} />
    {blogPosts.slice(1).map((post) => (
      <BlogCard key={post.id} ... onClick={() => setSelectedPost(post)} />
    ))}
  </>
)}
  • The first post is drawn big, as the Featured Article (featured={true}).
  • The other four go into a grid under Recent Articles (blogPosts.slice(1)).
  • Click a card, and that post becomes selectedPost, so the page shows BlogPost, the full article.
  • Back to all posts calls setSelectedPost(null), and the list comes back.

So for now the posts are fixed sample text. In our app, they'll come from the database.

One piece: BlogCard.tsx

BlogCard.tsx is 53 lines long. At the top, BlogCardProps lists what a card needs before it can be drawn:

interface BlogCardProps {
  id: number;
  title: string;
  excerpt: string;
  author: string;
  date: string;
  readTime: string;
  category: string;
  onClick: () => void;
  featured?: boolean;
}

The card itself draws, in order:

  • the category in a small pill, with the read time next to it,
  • the title, then the excerpt, cut to three lines (line-clamp-3),
  • a circle with the author's first letter ({author.charAt(0)}), then the name and the date.

featured makes the same card bigger (md:col-span-2 md:row-span-2, more padding, a bigger title). That's how the first post stands out.

The list of props is a good hint of what each post in your blog needs to store. A category, an excerpt and a read time are on every card, and none of the first blogs stored them. In the Django track, that's exactly what changed when the design went in (two new fields and a read-time helper); the FastAPI and Flask agents kept their models as they were. See Handing a Figma Design to an AI Agent.

Where this goes next

We don't run this React code in the blog. The agent reads it and rebuilds the look in the framework you use:

TrackThe design becomes
DjangoDjango templates and static files
FastAPIJinja2 templates that FastAPI serves
FlaskJinja2 templates in the Flask app

Common mistakes

  • Reading all 57 files. Start from the imports in App.tsx. The 48 ui files aren't used by this page.
  • Treating the sample posts as data. They're written into App.tsx only so the design has something to show.
  • Skipping the design review. Ask for changes in the design tool, where they're cheap, before the agent copies the look into every template.

Quick recap

FileWhat it tells you
App.tsxthe page: a featured post, a grid of recent posts, and selectedPost to switch to one post
BlogCard.tsxwhat a card needs: title, excerpt, author, date, read time, category
BlogPost.tsxthe page for reading one post
styles/theme.cssthe colours as named values

Try it yourself

Open BlogPost.tsx, list the props it needs, and compare them with BlogCard. Which ones does the full post need that the card doesn't?

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in React · 2 of 59

Previous
One Request, Two Answers: the Same Post as an HTML Page and as JSON
Next post
How a Web Page Works: HTML Tags, Elements and Attributes

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

Semantic HTML: header, nav, main, aside and footer as Page Landmarks

The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.

HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)

Follow a sign-up form's answers out of the page: label and id, name as the key, browser validation, the query string a GET form builds, and why POST hides it. Plus the most common bug, an input with no name.

On this page

  • What a design gives you
  • A design from a prompt
  • Download and unzip
  • What's inside
  • The page: App.tsx
  • One piece: BlogCard.tsx
  • Where this goes next
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.