├── .gitignore
├── .npmrc
├── .stackblitzrc
├── README.md
├── astro.config.mjs
├── package-lock.json
├── package.json
├── public
└── favicon.ico
├── sandbox.config.json
├── src
├── components
│ ├── Comment.astro
│ ├── Layout.astro
│ ├── Story.astro
│ └── Toggle.jsx
├── lib
│ └── api.js
├── pages
│ ├── [...stories].astro
│ ├── stories
│ │ └── [id].astro
│ └── users
│ │ └── [id].astro
└── styles
│ └── global.css
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # build output
2 | dist/
3 | .output/
4 |
5 | # dependencies
6 | node_modules/
7 |
8 | # logs
9 | npm-debug.log*
10 | yarn-debug.log*
11 | yarn-error.log*
12 | pnpm-debug.log*
13 |
14 |
15 | # environment variables
16 | .env
17 | .env.production
18 |
19 | # macOS-specific files
20 | .DS_Store
21 |
22 | # Local Netlify folder
23 | .netlify
24 | netlify
25 | .vscode
26 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | # Expose Astro dependencies for `pnpm` users
2 | shamefully-hoist=true
3 |
--------------------------------------------------------------------------------
/.stackblitzrc:
--------------------------------------------------------------------------------
1 | {
2 | "startCommand": "npm start",
3 | "env": {
4 | "ENABLE_CJS_IMPORTS": true
5 | }
6 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Astro-Solid Hacker News
2 |
3 | This repos is a simple demo of using Astro + SolidJS integration to do a Hackernews Clone with Partial Hydration. It is setup with the Netlify Adapter and you can see it deployed [here](https://astro-solid-hn.netlify.app).
4 |
5 | ## 🧞 Commands
6 |
7 | All commands are run from the root of the project, from a terminal:
8 |
9 | | Command | Action |
10 | |:---------------- |:-------------------------------------------- |
11 | | `npm install` | Installs dependencies |
12 | | `npm run dev` | Starts local dev server at `localhost:3000` |
13 | | `npm run build` | Build your production site to `./dist/` |
14 | | `npm run preview` | Preview your build locally, before deploying |
15 |
16 | ## 👀 Want to learn more?
17 |
18 | Feel free to check [our documentation](https://github.com/withastro/astro) or jump into our [Discord server](https://astro.build/chat).
19 |
--------------------------------------------------------------------------------
/astro.config.mjs:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'astro/config';
2 | import netlify from "@astrojs/netlify";
3 |
4 | import solid from "@astrojs/solid-js";
5 |
6 | // https://astro.build/config
7 | export default defineConfig({
8 | adapter: netlify(),
9 | integrations: [solid()]
10 | });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "astro-solid-hn",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "dev": "astro dev",
7 | "start": "astro dev",
8 | "build": "astro build",
9 | "preview": "astro preview"
10 | },
11 | "devDependencies": {
12 | "@astrojs/solid-js": "^0.1.2",
13 | "astro": "^1.0.0-beta.20",
14 | "solid-js": "^1.3.14"
15 | },
16 | "dependencies": {
17 | "@astrojs/netlify": "^0.3.3"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ryansolid/astro-solid-hackernews/abbc08b8c5e53fdd018e39d77c5e14479299b66e/public/favicon.ico
--------------------------------------------------------------------------------
/sandbox.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "infiniteLoopProtection": true,
3 | "hardReloadOnChange": false,
4 | "view": "browser",
5 | "template": "node",
6 | "container": {
7 | "port": 3000,
8 | "startScript": "start",
9 | "node": "14"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/Comment.astro:
--------------------------------------------------------------------------------
1 | ---
2 | import Toggle from "./Toggle";
3 | const { comment } = Astro.props;
4 | ---
5 |
23 | {story.comments_count 24 | ? story.comments_count + " comments" 25 | : "No comments yet."} 26 |
27 |28 | {story.comments.map((comment) => ( 29 |
30 | ))}
31 |
32 |