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.
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:
| Part | What it says |
|---|---|
| Role | You're a web designer. |
| Context | A simple blog, with posts in a few categories. |
| Task | Design a home page with one featured post and a grid of recent posts, and a page to read a single post. |
| Format | A 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
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.tsxis the page itself.- In
components,BlogCardis one post in the list, andBlogPostis the page where you read a single post. - The
uifolder holds 48 ready-made pieces, like a button, a card and a dialog. stylesholds the look.theme.csskeeps 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 showsBlogPost, 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:
| Track | The design becomes |
|---|---|
| Django | Django templates and static files |
| FastAPI | Jinja2 templates that FastAPI serves |
| Flask | Jinja2 templates in the Flask app |
Common mistakes
- Reading all 57 files. Start from the imports in
App.tsx. The 48uifiles aren't used by this page. - Treating the sample posts as data. They're written into
App.tsxonly 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
| File | What it tells you |
|---|---|
App.tsx | the page: a featured post, a grid of recent posts, and selectedPost to switch to one post |
BlogCard.tsx | what a card needs: title, excerpt, author, date, read time, category |
BlogPost.tsx | the page for reading one post |
styles/theme.css | the 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?
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.
