mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
add dark mode on default start page
This commit is contained in:
@@ -17,4 +17,8 @@ module.exports = ( app, settings ) => {
|
|||||||
app.get( '/startPage/helperFunction', ( req, res ) => {
|
app.get( '/startPage/helperFunction', ( req, res ) => {
|
||||||
res.sendFile( path.join( __dirname + '/../ui/home/helper.js' ) );
|
res.sendFile( path.join( __dirname + '/../ui/home/helper.js' ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
app.get( '/startPage/mainStyle', ( req, res ) => {
|
||||||
|
res.sendFile( path.join( __dirname + '/../ui/home/main.css' ) );
|
||||||
|
} );
|
||||||
};
|
};
|
||||||
@@ -3,16 +3,20 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"> -->
|
||||||
|
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||||
<link rel="stylesheet" href="/supportFiles/style.css">
|
<link rel="stylesheet" href="/supportFiles/style.css">
|
||||||
|
<link rel="stylesheet" href="/startPage/mainStyle">
|
||||||
|
<script defer src="/startPage/helperFunction"></script>
|
||||||
<title>libreevent</title>
|
<title>libreevent</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/">Home</a> |
|
<a class="home">Home</a> |
|
||||||
<router-link to="/tickets">Tickets</router-link> |
|
<a href="/tickets">Tickets</a> |
|
||||||
<router-link to="/cart">Cart</router-link> |
|
<a href="/cart">Cart</a> |
|
||||||
<router-link to="/account">Account</router-link> |
|
<a href="/account">Account</a> |
|
||||||
<button @click="changeTheme();" v-html="theme" id="themeSelector"></button>
|
<button onclick="changeTheme();" id="themeSelector">☽</button>
|
||||||
</nav>
|
</nav>
|
||||||
<img src="/otherAssets/logo.png" alt="libreevent logo" class="logo">
|
<img src="/otherAssets/logo.png" alt="libreevent logo" class="logo">
|
||||||
<h1>Welcome to libreevent!</h1>
|
<h1>Welcome to libreevent!</h1>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
var theme = localStorage.getItem( 'theme' ) ?? '';
|
||||||
|
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || theme === '☼' ) {
|
||||||
|
document.documentElement.classList.add( 'dark' );
|
||||||
|
document.getElementById( 'themeSelector' ).innerHTML = '☼';
|
||||||
|
theme = '☼';
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add( 'light' );
|
||||||
|
document.getElementById( 'themeSelector' ).innerHTML = '☽';
|
||||||
|
theme = '☽';
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeTheme () {
|
||||||
|
if ( theme === '☼' ) {
|
||||||
|
document.documentElement.classList.remove( 'dark' );
|
||||||
|
document.documentElement.classList.add( 'light' );
|
||||||
|
localStorage.setItem( 'theme', '☽' );
|
||||||
|
document.getElementById( 'themeSelector' ).innerHTML = '☽';
|
||||||
|
theme = '☽';
|
||||||
|
} else if ( theme === '☽' ) {
|
||||||
|
document.documentElement.classList.remove( 'light' );
|
||||||
|
document.documentElement.classList.add( 'dark' );
|
||||||
|
localStorage.setItem( 'theme', '☼' );
|
||||||
|
document.getElementById( 'themeSelector' ).innerHTML = '☼';
|
||||||
|
theme = '☼';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,4 +59,35 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a {
|
||||||
|
font-weight: bold;
|
||||||
|
color: var( --primary-color );
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .home {
|
||||||
|
color: #42b983;
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
color: var( --primary-color );
|
||||||
|
background-color: var( --background-color );
|
||||||
|
transition: all 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user