Skip to content

sammanthp007/codecamp-by-scc-web-201-wk1-lab

Repository files navigation

πŸ§ͺ Week 1 Lab β€” Mini Text Toolkit

Mission: Build and deploy your first React + TypeScript web app that manipulates text.

⏱ Time: 1-2 hours
🎯 Goal: Ship a working Mini Text Toolkit with three features: Reverse Text, Word Count, and Title Case.


πŸš€ Getting Started

Prerequisites

Before starting this lab, ensure you have:

  • βœ… Node.js 18+ installed (node -v)
  • βœ… pnpm installed (pnpm -v)
  • βœ… Git configured (git config --list)
  • βœ… Firebase CLI installed and logged in (firebase login)
  • βœ… VS Code with ESLint & Prettier extensions

If you haven't set these up yet, refer to PART A of the lab instructions.


πŸ“‚ Project Structure

week1-lab-text-tools/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.tsx              # Main React component (UI structure)
β”‚   β”œβ”€β”€ App.css              # Component styles
β”‚   β”œβ”€β”€ main.tsx             # React entry point
β”‚   β”œβ”€β”€ index.css            # Global styles
β”‚   └── utils/
β”‚       └── textTools.ts     # ⚠️ YOUR CODE GOES HERE
β”œβ”€β”€ index.html               # HTML template
β”œβ”€β”€ package.json             # Dependencies & scripts
β”œβ”€β”€ tsconfig.json            # TypeScript config (strict mode)
β”œβ”€β”€ firebase.json            # Firebase Hosting config
└── README.md                # This file

πŸ›  Setup Instructions

1️⃣ Install Dependencies

pnpm install

This will install all required packages (React, TypeScript, Vite, etc.)

2️⃣ Start Development Server

pnpm dev

Open http://localhost:5173 in your browser.

You'll see the UI is ready, but the buttons don't work yet. That's your job! ✨


✍️ Your Task: Implement the Logic Functions

Open src/utils/textTools.ts and implement these three functions:

πŸ”„ Function 1: Reverse Text

export function reverseText(input: string): string {
  // TODO: Implement this
  // Hint: Use split(''), reverse(), and join('')
}

Example:

  • Input: "hello" β†’ Output: "olleh"
  • Input: "Code Camp" β†’ Output: "pmaC edoC"

πŸ”’ Function 2: Count Words

export function countWords(input: string): number {
  // TODO: Implement this
  // Hint: Use trim(), split(/\s+/), and filter(Boolean)
}

Example:

  • Input: "hello world" β†’ Output: 2
  • Input: " " β†’ Output: 0
  • Input: "Code Camp 2024" β†’ Output: 3

πŸ”€ Function 3: Title Case

export function toTitleCase(input: string): string {
  // TODO: Implement this
  // Hint: Split by spaces, capitalize first letter of each word, then join
}

Example:

  • Input: "hello world" β†’ Output: "Hello World"
  • Input: "code camp week 1" β†’ Output: "Code Camp Week 1"

βœ… Testing Your Code

After implementing the functions:

  1. Manual Testing:

  2. TypeScript Check:

    pnpm typecheck

    Should show no errors βœ…

  3. Linting:

    pnpm lint

    Should show no warnings βœ…

  4. Format Code:

    pnpm format

🚒 Deployment Instructions

1️⃣ Build for Production

pnpm build

This creates an optimized build in the dist/ folder.

2️⃣ Configure Firebase

First, update .firebaserc with your Firebase project ID:

{
  "projects": {
    "default": "cc-yourname-week1"
  }
}

3️⃣ Deploy to Firebase Hosting

firebase deploy

After deployment, you'll see:

βœ”  Deploy complete!
Project URL: https://cc-yourname-week1.web.app

Visit that URL and test your live app! πŸŽ‰


πŸ“ Submission Checklist

Before submitting, ensure:

  • All 3 features work correctly (Reverse, Count, Title Case)
  • pnpm typecheck passes with no errors
  • pnpm lint passes with no warnings
  • App is deployed to Firebase and accessible via public URL
  • Footer shows your name (edit App.tsx line 49)
  • README updated with your info (see below)

Update This README

Replace the sections below with your own information:

## πŸ‘€ Student Info

**Name:** [Your Full Name]  
**Cohort:** [Your Cohort Name]  
**Live Demo:** [Your Firebase URL]

## 🎯 What I Learned

1. [Something you learned about React]
2. [Something you learned about TypeScript]
3. [Something you learned about deployment]

🌟 Stretch Goals (Optional)

If you finish early, try adding:

  • Character Count below the textarea (live counter)
  • Copy to Clipboard button for the output
  • Clear Text button to reset both input and output
  • Dark Mode toggle (use CSS variables)

πŸ†˜ Troubleshooting

Error: Cannot find module 'react'

Fix: Run pnpm install

TypeScript error: Property 'value' does not exist

Fix: Ensure you're using proper types. The textarea is already typed correctly in App.tsx

Blank page after deployment

Fix:

  1. Check browser console for errors
  2. Verify firebase.json has "public": "dist"
  3. Make sure you ran pnpm build before deploying

Functions return empty/zero but no errors

Fix: You haven't implemented the logic yet! Open src/utils/textTools.ts and write the code.


πŸ“š Resources


πŸŽ“ Grading Rubric

Category Points Criteria
Functionality 40% All 3 features work correctly
Code Quality 25% TypeScript strict mode, ESLint clean, proper naming
Deployment 20% Live Firebase URL accessible
Documentation 15% README updated, clear commit messages

Total: 100 points


πŸ‘€ Student Info

Name: [Your Full Name]
Cohort: [Your Cohort Name]
Live Demo: [Your Firebase URL]
GitHub Repo: [Your forked repo URL]

🎯 What I Learned

  1. [Add your learnings here after completing the lab]

πŸ“œ License

This lab is part of Code Camp by SCC. For educational purposes only.


πŸ’¬ "Your first deployed React app starts here. Make it count!"
β€” Code Camp by SCC

About

The starter project for Code Camp by SCC's Web-101's Week 1 - Lab

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published