diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9a2840d --- /dev/null +++ b/.drone.yml @@ -0,0 +1,69 @@ +--- +kind: pipeline +type: docker +name: node16 + +steps: +- name: view-staging-url + image: node:16 + commands: + - echo "staging url will be https://${DRONE_BRANCH//\//-}-csc-class-profile-staging-snedadah.k8s.csclub.cloud" + +- name: install-deps + image: node:16 + commands: + - npm install + +- name: lint + image: node:16 + depends_on: + - install-deps + commands: + - npm run lint + +- name: build + image: node:16 + depends_on: + - install-deps + commands: + - npm run build + +- name: export + image: node:16 + depends_on: + - build + commands: + - npm run export + +- name: publish + image: plugins/docker:latest + depends_on: + - export + settings: + username: + from_secret: HARBOUR_USERNAME + password: + from_secret: HARBOUR_PASSWORD + tags: + - ${DRONE_BRANCH//\//-} + - latest + registry: registry.cloud.csclub.uwaterloo.ca + repo: registry.cloud.csclub.uwaterloo.ca/snedadah/csc-class-profile-staging + +- name: deploy + image: node:16 + depends_on: + - publish + environment: + STAGING_AUTH_TOKEN: + from_secret: STAGING_AUTH_TOKEN + commands: + - echo "The docker build tag is ${DRONE_BRANCH//\//-}" + - 'curl -H "Authorization: $STAGING_AUTH_TOKEN" https://csclub.uwaterloo.ca/~snedadah/webhooks/cscclassprofilestaging?ref=${DRONE_BRANCH//\//-}' + +trigger: + event: + exclude: + - pull_request #avoid double build on PRs + + diff --git a/.vscode/settings.json b/.vscode/settings.json index 02cf98f..12f41f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,7 +41,11 @@ "files.eol": "\n", "[markdown]": { "editor.wordWrap": "on", - "editor.quickSuggestions": false, + "editor.quickSuggestions": { + "comments": "off", + "strings": "off", + "other": "off" + }, "editor.tabSize": 4 } } diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e0c32c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx +COPY ./out /usr/share/nginx/html + +COPY staging-nginx.conf /etc/nginx/conf.d +RUN rm /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/components/ColorPalette.module.css b/components/ColorPalette.module.css new file mode 100644 index 0000000..01bc6a5 --- /dev/null +++ b/components/ColorPalette.module.css @@ -0,0 +1,21 @@ +.box { + width: calc(100rem / 16); + height: calc(100rem / 16); + margin-bottom: calc(10rem / 16); +} + +.wrapper { + display: flex; + flex-direction: row; + justify-content: space-around; + flex-wrap: wrap; +} + +.item { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + margin: calc(10rem / 16); + width: calc(150rem / 16); +} \ No newline at end of file diff --git a/components/ColorPalette.tsx b/components/ColorPalette.tsx new file mode 100644 index 0000000..835faa3 --- /dev/null +++ b/components/ColorPalette.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import { Color } from "utils/Color"; + +import styles from "./ColorPalette.module.css"; + +export function ColorPalette() { + return ( + <> +

Color Palette

+
+ {Object.entries(Color).map(([colorName, colorCSSName]) => ( +
+
+ {colorName} +
+ ))} +
+ + ); +} diff --git a/docs/CI.md b/docs/CI.md new file mode 100644 index 0000000..bdc8238 --- /dev/null +++ b/docs/CI.md @@ -0,0 +1,8 @@ +## Setting up CI + +- Follow instructions on [CSC cloud](https://docs.cloud.csclub.uwaterloo.ca/kubernetes/) to setup csccloud. +- Setup the repository to store your docker images on [CSC Harbour](https://docs.cloud.csclub.uwaterloo.ca/registry/). +- Make sure to add harbour auth tokens to drone. Click the my profile page on harbour, and set HARBOUR_USERNAME and HARBOUR_PASSWORD on drone secrets to the username and cli secret from the harbour profile page. +- Clone the [server repo](https://git.csclub.uwaterloo.ca/snedadah/csc-webhooks), fill in desired links, update env file with the auth token, update STAGING_AUTH_TOKEN in drone to match. Run `npm start` to start server in the background. +- Possibly put a crontab to restart the script on [startup](https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup) + diff --git a/next.config.js b/next.config.js index a843cbe..0128f08 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + trailingSlash: true, } module.exports = nextConfig diff --git a/pages/font.css b/pages/font.css index 07147f0..c6ea327 100644 --- a/pages/font.css +++ b/pages/font.css @@ -5,7 +5,7 @@ font-weight: 200; src: local(''), url('../public/fonts/inconsolata-v30-latin-200.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-200.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-200.woff') format('woff'); } /* inconsolata-300 - latin */ @@ -15,7 +15,7 @@ font-weight: 300; src: local(''), url('../public/fonts/inconsolata-v30-latin-300.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-300.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-300.woff') format('woff'); } /* inconsolata-regular - latin */ @@ -25,7 +25,7 @@ font-weight: 400; src: local(''), url('../public/fonts/inconsolata-v30-latin-regular.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-regular.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-regular.woff') format('woff'); } /* inconsolata-500 - latin */ @@ -35,7 +35,7 @@ font-weight: 500; src: local(''), url('../public/fonts/inconsolata-v30-latin-500.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-500.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-500.woff') format('woff'); } /* inconsolata-600 - latin */ @@ -46,7 +46,7 @@ src: local(''), url('../public/fonts/inconsolata-v30-latin-600.woff2') format('woff2'), /* Super Modern Browsers */ - url('../public/fonts/inconsolata-v30-latin-600.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-600.woff') format('woff'); } /* inconsolata-700 - latin */ @@ -56,7 +56,7 @@ font-weight: 700; src: local(''), url('../public/fonts/inconsolata-v30-latin-700.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-700.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-700.woff') format('woff'); } /* inconsolata-800 - latin */ @@ -66,7 +66,7 @@ font-weight: 800; src: local(''), url('../public/fonts/inconsolata-v30-latin-800.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-800.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-800.woff') format('woff'); } /* inconsolata-900 - latin */ @@ -76,5 +76,5 @@ font-weight: 900; src: local(''), url('../public/fonts/inconsolata-v30-latin-900.woff2') format('woff2'), - url('../public/fonts/inconsolata-v30-latin-900.woff') format('woff'), + url('../public/fonts/inconsolata-v30-latin-900.woff') format('woff'); } diff --git a/pages/playground.tsx b/pages/playground.tsx index b31b37e..f430e95 100644 --- a/pages/playground.tsx +++ b/pages/playground.tsx @@ -1,10 +1,13 @@ import React from "react"; +import { ColorPalette } from "../components/ColorPalette"; + export default function Home() { return ( <>

Playground

Show off your components here!

+ ); } diff --git a/staging-nginx.conf b/staging-nginx.conf new file mode 100644 index 0000000..4e05092 --- /dev/null +++ b/staging-nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ $uri.html $uri.html/ /index.html; + } + error_page 404 /index.html; + } + \ No newline at end of file diff --git a/utils/Color.ts b/utils/Color.ts new file mode 100644 index 0000000..d3adb28 --- /dev/null +++ b/utils/Color.ts @@ -0,0 +1,38 @@ +const colorNames = [ + "primaryBackground", + "secondaryBackground", + "tertiaryBackground", + "primaryAccent", + "primaryAccentLight", + "primaryAccentLighter", + "secondaryAccent", + "secondaryAccentLight", + "primaryHeading", + "secondaryHeading", + "link", + "linkHover", + "primaryText", + "cardBackground", + "label", +] as const; + +// This type is needed for smart autocomplete +type ColorName = typeof colorNames[number]; + +export const Color: { [key in ColorName]: string } = { + primaryBackground: "var(--primary-background)", + secondaryBackground: "var(--secondary-background)", + tertiaryBackground: "var(--tertiary-background)", + primaryAccent: "var(--primary-accent)", + primaryAccentLight: "var(--primary-accent-light)", + primaryAccentLighter: "var(--primary-accent-lighter)", + secondaryAccent: "var(--secondary-accent)", + secondaryAccentLight: "var(--secondary-accent-light)", + primaryHeading: "var(--primary-heading)", + secondaryHeading: "var(--secondary-heading)", + link: "var(--link)", + linkHover: "var(--link-hover)", + primaryText: "var(--primary-text)", + cardBackground: "var(--card-background)", + label: "var(--label)", +};