Skip to content

Commit

Permalink
Add new site using refinedsites
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Dec 23, 2023
1 parent 4abdbd2 commit d1a51fa
Show file tree
Hide file tree
Showing 488 changed files with 3,320 additions and 10,335 deletions.
67 changes: 16 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,21 @@
name: CI
on: [push, pull_request]
on: [ push, pull_request ]
env:
refinedSitesVersion: 0.1.0
jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm run build
- run: rm -rf node_modules
- uses: actions/upload-artifact@v3
with:
name: frontend-output
path: .
build-website:
runs-on: ubuntu-latest
needs: build-frontend
steps:
- uses: actions/checkout@v3
with:
repository: 'refinedmods/sitegen'
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- run: go build
- uses: actions/download-artifact@v3
with:
name: frontend-output
- run: chown $USER sitegen
- run: ./sitegen build
env:
SITEGEN_GITHUB_TOKEN: ${{ secrets.GH_METADATA_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: output
path: output/
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: build-website
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: output
path: output/
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: output/
- uses: actions/checkout@v3
- name: Use Refined Sites
run: wget "https://github.com/refinedmods/refinedsites/releases/download/v$refinedSitesVersion/refinedsites-$refinedSitesVersion.jar"
- name: Setup Java
uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop
- name: Build site
run: java -jar refinedsites-$refinedSitesVersion.jar .
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- run: npm run build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
output/
.idea
24 changes: 0 additions & 24 deletions LICENSE.md

This file was deleted.

90 changes: 0 additions & 90 deletions app.js

This file was deleted.

85 changes: 0 additions & 85 deletions app.scss

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
97 changes: 97 additions & 0 deletions assets/js/color-modes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
*/

(() => {
'use strict'

const getStoredTheme = () => localStorage.getItem('theme')
const setStoredTheme = theme => localStorage.setItem('theme', theme)

const getPreferredTheme = () => {
const storedTheme = getStoredTheme()
if (storedTheme) {
return storedTheme
}

return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
}

const setTheme = theme => {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-bs-theme', 'dark')
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}

setTheme(getPreferredTheme())

const showActiveTheme = (theme, focus = false) => {
const themeSwitcher = document.querySelector('#bd-theme')

if (!themeSwitcher) {
return
}

const themeSwitcherText = document.querySelector('#bd-theme-text')
const activeThemeIcon = document.querySelector('.theme-icon-active')
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)

document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
element.setAttribute('aria-pressed', 'false')
})

document.querySelectorAll('.theme-check').forEach(element => {
element.classList.add('d-none')
});

btnToActive.querySelector('.theme-check').classList.remove('d-none')

if (activeThemeIcon.classList.contains('bi-circle-half')) {
activeThemeIcon.classList.remove('bi-circle-half')
}
if (activeThemeIcon.classList.contains('bi-sun-fill')) {
activeThemeIcon.classList.remove('bi-sun-fill')
}
if (activeThemeIcon.classList.contains('bi-moon-stars-fill')) {
activeThemeIcon.classList.remove('bi-moon-stars-fill')
}
activeThemeIcon.classList.add(
theme === 'light' ? 'bi-sun-fill' : theme === 'dark' ? 'bi-moon-stars-fill' : 'bi-circle-half'
)

btnToActive.classList.add('active')
btnToActive.setAttribute('aria-pressed', 'true')
const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`
themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)

if (focus) {
themeSwitcher.focus()
}
}

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
const storedTheme = getStoredTheme()
if (storedTheme !== 'light' && storedTheme !== 'dark') {
setTheme(getPreferredTheme())
}
})

window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())

document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value')
setStoredTheme(theme)
setTheme(theme)
showActiveTheme(theme, true)
})
})
})
})()
Loading

0 comments on commit d1a51fa

Please sign in to comment.