โปรแกรมเว็บแอปพลิเคชันเครื่องคิดเลขพื้นฐานที่รองรับการดำเนินการทางคณิตศาสตร์ ที่พัฒนาด้วย TypeScript และ Vite พร้อมระบบธีม Light/Dark Mode
• 🔢 การคำนวณพื้นฐาน - บวก ลบ คูณ หาร ตัวเลขสองจำนวน • 🎨 UI สวยงาม - ใช้ฟอนต์ IBM Plex Sans Thai และ CSS3 animations • 🌙 Dark/Light Theme - สลับระหว่างธีมมืดและสว่างได้ • 🔄 Real-time Validation - ตรวจสอบข้อมูลป้อนเข้าแบบ real-time • 📱 Responsive Design - รองรับการใช้งานบนอุปกรณ์ต่างๆ • 🎉 Toast Notifications - แสดงการแจ้งเตือนและผลลัพธ์ • ⚡ Performance Optimized - ใช้ TypeScript สำหรับความเสถียร
• TypeScript - ภาษาหลักสำหรับการพัฒนา • Vite - Build tool และ development server • HTML5 - โครงสร้างหน้าเว็บ • CSS3 - Styling พร้อม animations และ transitions • Google Fonts - IBM Plex Sans Thai
• Node.js (เวอร์ชั่น 16 หรือสูงกว่า) • npm หรือ yarn
-
Clone โปรเจ็กต์
git clone https://github.com/xenodeve/webhw05_s0330250.git cd webhw05_s0330250
-
ติดตั้ง Dependencies
npm install
-
รันในโหมด Development
npm run dev
-
Build สำหรับ Production
npm run build
-
Preview Production Build
npm run preview
webhw05_s0430250/
├── public/
│ ├── favicon.png # ไอคอนเว็บไซต์
│ ├── favicon.svg # ไอคอน SVG
│ └── vite.svg # Vite logo
├── src/
│ ├── main.ts # Entry point หลัก
│ ├── style.css # CSS หลัก
│ ├── theme.ts # จัดการระบบธีม
│ ├── toast.ts # ระบบ Toast notifications
│ ├── toast.css # CSS สำหรับ toast
│ └── vite-env.d.ts # Type definitions
├── index.html # HTML หลัก
├── package.json # Dependencies และ scripts
├── tsconfig.json # TypeScript configuration
└── README.md # เอกสารนี้
- กรอกตัวเลขที่ 1 - ใส่จำนวนตัวเลขแรก
- กรอกตัวเลขที่ 2 - ใส่จำนวนตัวเลขที่สอง
- เลือกการดำเนินการ - เลือกระหว่าง บวก (+), ลบ (-), คูณ (×), หาร (÷)
- กดปุ่มคำนวณ - กดปุ่ม "🔢 คำนวณ" เพื่อดูผลลัพธ์
- ดูผลลัพธ์ - ระบบจะแสดงผลลัพธ์ในช่อง "📊 ผลลัพธ์"
• ❌ ข้อมูลไม่ถูกต้อง - แสดง Toast warning เมื่อกรอกข้อมูลไม่ครบ
•
• Smooth transitions สำหรับ theme switching • Hover effects สำหรับปุ่มและ elements • Toast animations แบบ slide-in/fade-out • Responsive animations สำหรับการเปลี่ยนขนาดหน้าจอ
• Light Mode - ธีมสว่างสำหรับการใช้งานในตอนกลางวัน • Dark Mode - ธีมมืดสำหรับลดแสงจอและประหยัดแบตเตอรี่ • Auto Theme - ปรับธีมตามการตั้งค่าของระบบ
โปรแกรมรองรับการดำเนินการพื้นฐาน:
ผลลัพธ์ = ตัวเลขที่ 1 + ตัวเลขที่ 2
ผลลัพธ์ = ตัวเลขที่ 1 - ตัวเลขที่ 2
ผลลัพธ์ = ตัวเลขที่ 1 × ตัวเลขที่ 2
ผลลัพธ์ = ตัวเลขที่ 1 ÷ ตัวเลขที่ 2
(โดยที่ตัวเลขที่ 2 ≠ 0)
• Primary Color: #2eea9d
(เขียวมิ้นต์)
• Secondary Color: #00a94f
(เขียวเข้ม)
• Background: Dynamic gradient ตามธีม
• Text Color: ปรับตามธีมที่เลือก
• IBM Plex Sans Thai - ฟอนต์หลัก • Fallback: Segoe UI, Tahoma, Geneva, Verdana, sans-serif
- Build Error: unused variable - ตรวจสอบให้แน่ใจว่าตัวแปรทั้งหมดถูกใช้งาน
- Font ไม่แสดง - ตรวจสอบการเชื่อมต่อ Google Fonts ใน HTML
- Theme ไม่เปลี่ยน - ตรวจสอบ CSS variables และ theme.ts
- Toast ไม่แสดง - ตรวจสอบการ import toast module
# ตรวจสอบ linting
npm run build
# Clean install
rm -rf node_modules package-lock.json
npm install
# ดู development server logs
npm run dev -- --host
// การใช้งาน Toast notifications
import { toast } from './toast';
// แสดงข้อความสำเร็จ
toast.success('คำนวณเรียบร้อยแล้ว!');
// แสดงข้อความเตือน
toast.warning('กรุณาระบุตัวเลข');
// แสดงข้อความข้อผิดพลาด
toast.error('เกิดข้อผิดพลาด');
โปรเจ็กต์นี้สามารถ deploy บน:
• Vercel - แนะนำสำหรับ Vite projects
• Netlify - รองรับ static sites
• GitHub Pages - สำหรับ static hosting
- เชื่อมต่อ GitHub repository
- เลือก build command:
npm run build
- เลือก output directory:
dist
- Deploy!
โปรเจ็กต์นี้เป็นส่วนหนึ่งของการงานในการเรียน Web Development
• Student ID: s0430250 • Repository: webhw05_s0430250 • Project: Homework 05 - Basic Calculator
Happy Calculating! 🚀