|
1 | | -# ALPHA HKU Official Website |
| 1 | +# ALPHA HKU Website |
2 | 2 |
|
3 | | -This is the official website for the ALPHA University Chapter at the University of Hong Kong, built with Next.js, TypeScript, and shadcn/ui. |
| 3 | + |
| 4 | +> The official website for the ALPHA University Chapter at the University of Hong Kong. |
4 | 5 |
|
5 | | -## Getting Started |
| 6 | +This guide is for developers maintaining or contributing to this project. |
6 | 7 |
|
7 | | -### Prerequisites |
| 8 | +## Tech Stack |
8 | 9 |
|
9 | | -- [Node.js](https://nodejs.org/en/) (v18 or later) |
10 | | -- [pnpm](https://pnpm.io/installation) |
| 10 | +- Framework: [Next.js](https://nextjs.org/) (App Router) |
| 11 | +- Language: [TypeScript](https://www.typescriptlang.org/) |
| 12 | +- UI: [shadcn/ui](https://ui.shadcn.com/) |
| 13 | +- Animations: [Framer Motion](https://www.framer.com/motion/) |
| 14 | +- Styling: [Tailwind CSS](https://tailwindcss.com/) |
| 15 | +- Code Quality: [ESLint](https://eslint.org/) & [Prettier](https://prettier.io/) |
| 16 | +- Package Manager: [pnpm](https://pnpm.io/) |
11 | 17 |
|
12 | | -### Installation |
| 18 | +## Getting Started |
13 | 19 |
|
14 | | -1. **Clone the repository:** |
| 20 | +### Prerequisites |
15 | 21 |
|
16 | | - ```bash |
17 | | - git clone https://github.com/ALPHA-HKU/website.git |
18 | | - cd website |
19 | | - ``` |
| 22 | +- Node.js |
| 23 | +- pnpm |
20 | 24 |
|
21 | | -2. **Install dependencies:** |
| 25 | +### Setup |
22 | 26 |
|
23 | | - ```bash |
24 | | - pnpm install |
25 | | - ``` |
| 27 | +1. Clone the repo: |
26 | 28 |
|
27 | | -### Running the Development Server |
| 29 | + ```bash |
| 30 | + git clone https://github.com/ALPHA-HKU-Org/website.git |
| 31 | + cd website |
| 32 | + ``` |
28 | 33 |
|
29 | | -To start the development server, run: |
| 34 | +2. Install dependencies: |
30 | 35 |
|
31 | | -```bash |
32 | | -pnpm dev |
33 | | -``` |
34 | | - |
35 | | -Open [http://localhost:3000](http://localhost:3000) in your browser to see the result. |
| 36 | + ```bash |
| 37 | + pnpm install |
| 38 | + ``` |
36 | 39 |
|
37 | | -## Project Structure |
| 40 | +3. Run the dev server: |
38 | 41 |
|
39 | | -The project follows a standard Next.js App Router structure: |
| 42 | + ```bash |
| 43 | + pnpm dev |
| 44 | + ``` |
40 | 45 |
|
41 | | -```bash |
42 | | -├── public/ # Static assets (images, fonts, etc.) |
43 | | -├── src/ |
44 | | -│ ├── app/ # Application routes and layouts |
45 | | -│ ├── components/ # Reusable components |
46 | | -│ │ ├── ui/ # shadcn/ui components |
47 | | -│ │ └── ... |
48 | | -│ ├── lib/ # Utility functions |
49 | | -│ └── ... |
50 | | -├── .gitignore |
51 | | -├── next.config.ts |
52 | | -├── package.json |
53 | | -├── README.md |
54 | | -└── tsconfig.json |
55 | | -``` |
| 46 | + The site will be running at `http://localhost:3000`. |
56 | 47 |
|
57 | | -- **`src/app`**: Contains all the application's routes, with each folder representing a URL segment. `layout.tsx` defines the root layout, and `page.tsx` defines the content for each route. |
58 | | -- **`src/components`**: Home to all reusable React components. |
59 | | - - **`src/components/ui`**: This directory is specifically for components added from `shadcn/ui`. |
60 | | -- **`src/lib`**: Contains shared utility functions, such as the `cn` function for merging Tailwind CSS classes. |
61 | | -- **`public`**: Stores all static assets that are served directly, such as images and the site's manifest. |
| 48 | +## Available Scripts |
62 | 49 |
|
63 | | -## Building for Production |
| 50 | +- `pnpm dev`: Starts the development server with Next.js Turbo. |
| 51 | +- `pnpm build`: Creates a production-ready build. |
| 52 | +- `pnpm start`: Starts the production server (requires `pnpm build` first). |
| 53 | +- `pnpm lint`: Runs ESLint to find code quality issues. |
| 54 | +- `pnpm prettier --write .`: Formats all files. It's recommended to use the [Prettier VSCode extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for format-on-save. |
64 | 55 |
|
65 | | -To create a production-ready build, run the following command: |
| 56 | +## Project Structure |
66 | 57 |
|
67 | 58 | ```bash |
68 | | -pnpm build |
| 59 | +. |
| 60 | +├── src/ |
| 61 | +│ ├── app/ # Next.js App Router pages and layouts. |
| 62 | +│ ├── components/ |
| 63 | +│ │ ├── features/ # Self-contained features (e.g., theme toggle, cursor). |
| 64 | +│ │ ├── layout/ # Global layout components (Header, Footer). |
| 65 | +│ │ ├── sections/ # Reusable page sections (e.g., Hero, WhoWeAre). |
| 66 | +│ │ └── ui/ # Base UI components from shadcn/ui. |
| 67 | +│ └── lib/ # Utilities (cn function) and site configuration. |
| 68 | +├── public/ # Static assets (images, icons). |
69 | 69 | ``` |
70 | 70 |
|
71 | | -This will generate an optimized build in the `.next` directory, which can then be deployed. |
72 | | - |
73 | | -## `shadcn/ui` Integration |
| 71 | +## Working with `shadcn/ui` |
74 | 72 |
|
75 | | -We leverage `shadcn/ui` for our core UI components to ensure consistency and accessibility. |
76 | | - |
77 | | -### Existing Components |
78 | | - |
79 | | -The following `shadcn/ui` components are currently in use: |
80 | | - |
81 | | -- `Button` |
82 | | -- `Card` |
83 | | -- `Carousel` |
84 | | -- `Collapsible` |
85 | | -- `DropdownMenu` |
86 | | -- `NavigationMenu` |
87 | | -- `Sheet` |
| 73 | +This project uses `shadcn/ui`. Do not install components from npm or other package managers directly. Use the CLI to add new components to ensure they are added correctly to the project. |
88 | 74 |
|
89 | 75 | ### Adding New Components |
90 | 76 |
|
91 | | -To add a new component, use the `shadcn` CLI. This is the recommended approach as it handles all dependencies automatically. |
92 | | - |
93 | | -For example, to add the `Button` component, run: |
| 77 | +To add a new component, run the following command, replacing `button` with the component you need: |
94 | 78 |
|
95 | 79 | ```bash |
96 | 80 | pnpm dlx shadcn@latest add button |
97 | 81 | ``` |
98 | 82 |
|
99 | | -This will add the new component to `src/components/ui` and ensure it's ready for use. |
| 83 | +This command will add the new component file (e.g., `button.tsx`) to `src/components/ui`. You can then import and use it throughout the application. |
0 commit comments