├── src ├── env.d.ts ├── assets │ └── base.css ├── pages │ ├── index.astro │ └── dinos │ │ └── [slug].astro ├── layouts │ └── Layout.astro └── components │ ├── Card.astro │ └── Footer.astro ├── .vscode ├── extensions.json └── launch.json ├── git-push.sh ├── astro.config.mjs ├── .gitignore ├── tsconfig.json ├── lib └── api.js ├── package.json ├── tailwind.config.cjs ├── README.md └── public └── favicon.svg /src/env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["astro-build.astro-vscode"], 3 | "unwantedRecommendations": [] 4 | } 5 | -------------------------------------------------------------------------------- /git-push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Enter the commit message: " 4 | read commit_message 5 | 6 | git add . 7 | git commit -am "$commit_message" 8 | git push origin main 9 | 10 | clear 11 | figlet "Done!" 12 | sleep 3 13 | clear 14 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "command": "./node_modules/.bin/astro dev", 6 | "name": "Development server", 7 | "request": "launch", 8 | "type": "node-terminal" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /astro.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'astro/config'; 2 | 3 | // https://astro.build/config 4 | import tailwind from '@astrojs/tailwind'; 5 | 6 | // https://astro.build/config 7 | export default defineConfig({ 8 | integrations: [tailwind()], 9 | output: 'static', 10 | }); 11 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "astro/tsconfigs/base", 3 | "compilerOptions": { 4 | // Needed for TypeScript intellisense in the template inside Vue files 5 | "jsx": "preserve", 6 | "baseUrl": ".", 7 | "allowJs": true, 8 | "types": ["astro/client"], 9 | "paths": { 10 | "~/*": ["src/*"], 11 | "lib/*": ["lib/*"] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/api.js: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv'; 2 | dotenv.config(); 3 | 4 | const API_URL = process.env.API_URL; 5 | 6 | // Gets post by API URL and given path 7 | export async function fetchAPI(path) { 8 | const res = await fetch(`${API_URL}${path}`); 9 | const json = await res.json(); 10 | 11 | return json; 12 | } 13 | 14 | export async function getPosts() { 15 | let posts = await fetchAPI('dinos?per_page=50&_embed'); 16 | return posts; 17 | } 18 | -------------------------------------------------------------------------------- /src/assets/base.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | h2 { 6 | @apply text-3xl font-extrabold; 7 | } 8 | 9 | p { 10 | @apply mt-2; 11 | } 12 | 13 | /* Scroll bar */ 14 | ::-webkit-scrollbar { 15 | width: 12px; 16 | } 17 | ::-webkit-scrollbar-thumb { 18 | background: #42536b; 19 | } 20 | ::-webkit-scrollbar-thumb:hover { 21 | background: #34445a; 22 | } 23 | ::-webkit-scrollbar-track { 24 | background-color: #1f2937; 25 | } 26 | -------------------------------------------------------------------------------- /src/pages/index.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import Layout from '../layouts/Layout.astro'; 3 | import Card from '~/components/Card.astro'; 4 | import { getPosts } from '../../lib/api'; 5 | 6 | let posts = await getPosts(); 7 | --- 8 | 9 | 10 |
13 | { 14 | posts.map((post) => ( 15 | <> 16 | 17 | 18 | )) 19 | } 20 |
21 |
22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@and249/astro-wordpress", 3 | "type": "module", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "dev": "astro dev", 8 | "start": "astro dev", 9 | "build": "astro build", 10 | "preview": "astro preview", 11 | "astro": "astro" 12 | }, 13 | "dependencies": { 14 | "@astrojs/tailwind": "^2.1.3", 15 | "astro": "^1.6.11", 16 | "astro-icon": "^0.8.0", 17 | "daisyui": "^2.42.1", 18 | "dotenv": "^16.0.3", 19 | "tailwindcss": "^3.2.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [require('daisyui')], 8 | daisyui: { 9 | themes: [ 10 | { 11 | mytheme: { 12 | primary: '#d94948', 13 | secondary: '#4959ed', 14 | accent: '#38077c', 15 | neutral: '#1F2228', 16 | 'base-100': '#1f2937', 17 | info: '#5eead4', 18 | success: '#126E52', 19 | warning: '#C49B08', 20 | error: '#FA1E29', 21 | }, 22 | }, 23 | ], 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /src/layouts/Layout.astro: -------------------------------------------------------------------------------- 1 | --- 2 | import '~/assets/base.css'; 3 | import Footer from '~/components/Footer.astro'; 4 | export interface Props { 5 | title: string; 6 | } 7 | 8 | const { title } = Astro.props; 9 | --- 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {title} 19 | 23 | 24 | 25 | 30 | 31 |
32 | 33 |
34 | 35 |