Skip to content

Commit

Permalink
Merge pull request #37 from UoaWDCC/global-styling
Browse files Browse the repository at this point in the history
Global styling
  • Loading branch information
Bobsters6666 authored Jun 22, 2024
2 parents a0e9540 + 45747b1 commit 8070804
Show file tree
Hide file tree
Showing 11 changed files with 658 additions and 27 deletions.
5 changes: 4 additions & 1 deletion web/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import netlify from "@astrojs/netlify";

import react from "@astrojs/react";

// https://astro.build/config
export default defineConfig({
site: "https://wdcc.co.nz",
outDir: "./dist",
integrations: [mdx(), sitemap(), tailwind()],
integrations: [mdx(), sitemap(), tailwind(), react()],
output: "static",
adapter: netlify(),
image: {
domains: ["wdcc-website.fly.storage.tigris.dev"],
},
});

17 changes: 17 additions & 0 deletions web/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.mjs",
"css": "src/global.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
13 changes: 12 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,26 @@
"@astrojs/check": "^0.5.6",
"@astrojs/mdx": "^2.1.1",
"@astrojs/netlify": "^5.2.0",
"@astrojs/react": "^3.6.0",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@astrojs/tailwind": "^5.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@typehaus/metropolis": "^12.0.0-next.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "^4.4.9",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.395.0",
"marked": "^12.0.1",
"marked-shiki": "^1.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"shiki": "^1.3.0",
"tailwindcss": "^3.4.3",
"tailwind-merge": "^2.3.0",
"tailwindcss": "^3.4.4",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.3.3"
}
}
56 changes: 56 additions & 0 deletions web/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
}
);
Button.displayName = "Button";

export { Button, buttonVariants };
79 changes: 79 additions & 0 deletions web/src/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 210 94% 49%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 210 94% 49%;
--radius: 0.5rem;
}

.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 94% 49%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 210 94% 49%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}

h1 {
@apply text-6xl font-extrabold leading-[5.8rem];
}

h2 {
@apply text-5xl font-extrabold leading-[3.75rem];
}

h3 {
@apply text-4xl font-bold leading-[2.5625rem];
}

h4 {
@apply text-3xl font-bold leading-[1.7625rem];
}

p {
@apply text-base leading-[1.5rem] font-[500];
}
}
6 changes: 3 additions & 3 deletions web/src/layouts/layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const TopographicImage = await getImage({ src: TopographicImageSrc });
<BaseHead title={title} description={description} />
</head>

<body class="max-h-screen relative w-screen overflow-x-hidden bg-slate-100">
<Header />
<main class="min-h-full w-screen static">
<body class="max-h-screen relative bg-slate-100 max-w-[1125px] mx-auto">
<Header />
<main class="min-h-full static">
<slot />
<!-- <Image alt="Topographic Wallpaper" width={100} height={200} quality="max" class="w-full absolute top-0 -z-10 opacity-70" src={TopographicImage.src}/> -->
</main>
Expand Down
6 changes: 6 additions & 0 deletions web/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
20 changes: 14 additions & 6 deletions web/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,26 @@ import fetchApi from "../lib/strapi";
import type Article from "../interfaces/article";
import { Image, getImage } from "astro:assets";
import { marked, parse } from "marked";
import Layout from "../layouts/layout.astro";
import Layout from '../layouts/layout.astro';
import { Button } from "@/components/ui/button"
import "@/global.css"
const index = await fetchApi<any>({
endpoint: "index?populate=*",
wrappedByKey: "data",
});
// const introContent = index.attributes.intro && await marked.parse(index.attributes.intro);
// const subIntroContent = index.attributes.subIntro && await marked.parse(index.attributes.subIntro);
---

<Layout
title="WDCC"
description="The Web Development & Consulting Club @ The University of Auckland"
/>
<Layout title='WDCC' description="The Web Development & Consulting Club @ The University of Auckland">
<h1>Test H1</h1>
<h2>Test H2</h2>
<h3>Test H3</h3>
<h4>Test H4</h4>
<p>Test P</p>
<p class="text-sm">Text xs</p>
<Button>Hello</Button>
</Layout>

87 changes: 82 additions & 5 deletions web/tailwind.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,93 @@
/** @type {import('tailwindcss').Config} */
export default {
module.exports = {
darkMode: ["class"],
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
prefix: "",
theme: {
container: {
center: true,
padding: "2rem",
screens: {
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1125px",
"2xl": "1400px",
},
},
fontSize: {
xs: "0.75rem",
sm: "0.875rem",
base: "1rem",
lg: "1.125rem",
xl: "1.25rem",
"2xl": "1.5rem",
"3xl": "1.75rem",
"4xl": "2.25rem",
"5xl": "3rem",
"6xl": "4.5rem",
},
extend: {
fontFamily: {
sans: ["Montserrat"],
display: ["Montserrat"],
sans: ["Quicksand", "sans-serif"],
display: ["Quicksand", "sans-serif"],
},
colors: {
primary: "#200E32",
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
destructive: {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
},
popover: {
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
card: {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
},

borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
keyframes: {
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [],
plugins: [require("tailwindcss-animate")],
};
8 changes: 7 additions & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"strictNullChecks": true
"strictNullChecks": true,
"jsx": "react-jsx",
"jsxImportSource": "react",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
Loading

0 comments on commit 8070804

Please sign in to comment.