π¨βοΈ Hack@Brown CSS-React Starter Pack
Welcome to the Hack@Brown CSS-React Starter Pack! This resource merges our CSS Starter Kit and React Starter Kit into one unified experience β designed to help hackers quickly get started building beautiful, responsive web apps from scratch.
Youβll find:
- css-starter/my-css-app β Learn CSS fundamentals and styling.
- react-starter/my-app β Learn React + Next.js fundamentals for interactive UIs.
π Getting Started
-
Clone and install both apps git clone cd hackatbrown-starter
Then install dependencies for both apps: cd css-starter/my-css-app && npm install cd ../../react-starter/my-app && npm install
-
Run both apps simultaneously Each app already has its own .env.local file to prevent port conflicts:
- Next.js app (React) β runs on http://localhost:3000
- CSS app (CRA) β runs on http://localhost:3001
To start them:
cd react-starter/my-app npm run dev # for development
cd css-starter/my-css-app npm start
π‘ If you see βCould not find a production build,β that means you ran npm start in the Next.js app. For production mode, use npm run build && npm start
π¨ CSS Starter Kit Overview
CSS (Cascading Style Sheets) defines the look and feel of HTML elements β text, colors, layout, and animations. Created by W3C, CSS lets you separate style from structure for cleaner, scalable code.
π Goal For beginners who want to understand how websites are styled, this starter walks through key CSS concepts and how they interact with HTML inside a simple React sandbox.
π Core Concepts
- Selectors β choose HTML elements to style (h1, .class, #id)
- Properties & values β define visual rules (color: blue;, font-size: 20px;)
- Flexbox β layout system for responsive design (https://css-tricks.com/snippets/css/a-guide-to-flexbox/)
π§© Try It Out Run the CSS app and explore how changes in App.css affect elements in App.js. Youβll see 3 menu cards β your tasks are to modify, style, and enhance them.
π» Tasks
- Center the heading with text-align and margin.
- Add spacing around .menucard using display: flex; justify-content: center;.
- Add padding inside each card (padding: 1rem;).
- Make cards responsive with flex-wrap: wrap;.
- Add shadows and rounded corners using box-shadow and border-radius.
- Contain overflowing images with overflow: hidden;.
- Add hover effects using transform: scale(1.1);.
- Stack cards on mobile with a @media query (β€600px).
- Improve typography by adjusting font sizes and spacing.
- Ensure consistent styling and color readability.
- Add accessibility with aria-label attributes.
π§ Helpful Resources
- CSS reference (MDN): https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
- CSS Color Names: https://www.cssportal.com/css3-color-names/
- Flexbox Froggy Game: https://flexboxfroggy.com/
- HTML + CSS cheatsheet: https://htmlcheatsheet.com/css/
βοΈ React + Next.js Starter Overview
React is the most widely used JavaScript library for building interactive UIs. This kit includes a Next.js + TypeScript setup β the same stack used in many modern web apps.
ποΈ How It Works React lets you compose UIs from reusable components. Next.js enhances this with:
- Routing β each file in app/ becomes a page
- Server-side rendering
- Simple deployment
Learn more:
- React Docs: https://react.dev/
- Next.js Learn Guide: https://nextjs.org/learn
π§° Useful Add-ons
- Tailwind CSS β utility-first CSS framework (https://tailwindcss.com/docs/guides/create-react-app)
- Material UI β pre-built React components (https://mui.com/material-ui/getting-started/installation/)
π§βπ» Running and Editing In the my-app folder: npm run dev
Visit http://localhost:3000
Open src/app/page.tsx to edit content β it should begin with: "use client"; import { useState } from "react";
This allows the component to use React hooks interactively.
π» Tasks
Below is the quick-start checklist; find the expanded explanations in react-starter-tasks.md.
- Explore the
app/directory to understand file-based routing and confirmapp/page.tsxrenders at http://localhost:3000. - Convert
app/page.tsxinto a client component (if needed) and add auseStatetheme toggle controlled by a button. - Create
app/components/Hero.tsxthat acceptstitleandsubtitleprops, rendering it frompage.tsx. - Style the hero using CSS Modules via
app/page.module.css, ensuring typography remains responsive. - Define a
resourcesarray and map over it inpage.tsxto render learning resource cards. - Build a controlled email signup form with
useState, preventing reload on submit and showing a confirmation message. - Move the resource list into an async server component
app/components/ResourceList.tsxand import it intopage.tsx. - Add an API route
app/api/echo/route.tsthat returns JSON and fetch it from a client component to display the response. - Improve accessibility with semantic HTML, descriptive labels, and visible keyboard focus states.
- Replace static
<img>tags with Next.js<Image>components and exportmetadatafromapp/layout.tsxfor SEO. - Create
app/error.tsxto handle unexpected errors gracefully and test it locally. - Run
npm run lintandnpm run build, noting any deployment requirements for services like Vercel.
ποΈ Repository Structure
hackatbrown-starter/ β βββ css-starter/ β βββ my-css-app/ (Create React App sandbox for CSS practice) β βββ react-starter/ βββ my-app/ (Next.js + React + TypeScript app)
π§© Tips for Hackathon Projects
- Use React (Next.js) for dynamic or multipage web apps.
- Use CSS Starter to polish your layout and visual design.
- Combine both skills: add custom CSS or Tailwind to your React app.
- Donβt be afraid to experiment β you canβt break the internet (locally π).
π Summary
| Starter | Path | Command | Port |
|---|---|---|---|
| CSS Starter | css-starter/my-css-app | npm start | 3001 |
| React Starter | react-starter/my-app | npm run dev | 3000 |
Happy hacking from the Hack@Brown Dev Team π