diff options
| author | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-04-04 14:53:32 -0400 | 
|---|---|---|
| committer | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-04-04 14:53:32 -0400 | 
| commit | b4a9cd9d540d42a61bee9045d41ada392305a8d5 (patch) | |
| tree | 3cddb6389800788cb5d8b397cf21dbd40142be1b /ufund-ui/src | |
| parent | 8cdf84ae4a6765db8f462cc71e2685c1d3514f08 (diff) | |
| download | JellySolutions-b4a9cd9d540d42a61bee9045d41ada392305a8d5.tar.gz JellySolutions-b4a9cd9d540d42a61bee9045d41ada392305a8d5.tar.bz2 JellySolutions-b4a9cd9d540d42a61bee9045d41ada392305a8d5.zip  | |
add light/dark mode toggle, only homepage is fully functional. -ak
Diffstat (limited to '')
| -rw-r--r-- | ufund-ui/src/app/app.component.css | 1 | ||||
| -rw-r--r-- | ufund-ui/src/app/app.component.html | 7 | ||||
| -rw-r--r-- | ufund-ui/src/app/app.component.ts | 6 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/home-page/home-page.component.css | 16 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/home-page/home-page.component.html | 10 | ||||
| -rw-r--r-- | ufund-ui/src/app/components/home-page/home-page.component.ts | 16 | ||||
| -rw-r--r-- | ufund-ui/src/index.html | 2 | ||||
| -rw-r--r-- | ufund-ui/src/styles.css | 45 | 
8 files changed, 78 insertions, 25 deletions
diff --git a/ufund-ui/src/app/app.component.css b/ufund-ui/src/app/app.component.css index f4ed668..6cb44f6 100644 --- a/ufund-ui/src/app/app.component.css +++ b/ufund-ui/src/app/app.component.css @@ -34,7 +34,6 @@      /*}*/      a { -        color: light-dark(black, white);          text-decoration: none;      } diff --git a/ufund-ui/src/app/app.component.html b/ufund-ui/src/app/app.component.html index f697695..a6e6e6a 100644 --- a/ufund-ui/src/app/app.component.html +++ b/ufund-ui/src/app/app.component.html @@ -5,12 +5,13 @@          </a>      </div>      <div> -        <a *ngIf="(currentUser | async)?.type === userType.MANAGER" routerLink="/dashboard">Dashboard</a> -        <a routerLink="/cupboard">Cupboard</a> -        <a *ngIf="(currentUser | async)?.type === userType.HELPER" routerLink="/basket">Basket</a> +        <button *ngIf="(currentUser | async)?.type === userType.MANAGER" routerLink="/dashboard">Dashboard</button> +        <button routerLink="/cupboard">Cupboard</button> +        <button *ngIf="(currentUser | async)?.type === userType.HELPER" routerLink="/basket">Basket</button>  <!--        <span>{{currentUser$ | async}}</span>-->          <button *ngIf="currentUser | async" (click)="logout()"> Log Out</button>          <button *ngIf="!(currentUser | async)" (click)="login()"> Log In</button> +        <button class="button" (click)="toggleColorScheme()"><span class="icon">brightness_7</span></button>      </div>  </div> diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index bc0e71a..635061c 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -49,5 +49,11 @@ export class AppComponent implements OnInit {          location.reload()      } +    toggleColorScheme() { +        let newTheme = this.document.body.parentElement!.getAttribute("theme") == "light" ? "dark" : "light"; +        this.document.body.parentElement!.setAttribute("theme",newTheme); +        console.log(newTheme, this.document.body.parentElement); +    } +      protected readonly userType = userType;  } diff --git a/ufund-ui/src/app/components/home-page/home-page.component.css b/ufund-ui/src/app/components/home-page/home-page.component.css index a10377f..f6e5631 100644 --- a/ufund-ui/src/app/components/home-page/home-page.component.css +++ b/ufund-ui/src/app/components/home-page/home-page.component.css @@ -6,7 +6,6 @@      justify-content: center;      overflow: clip;  } -  #hero {      display: flex;      /*flex-direction: column;*/ @@ -19,12 +18,21 @@ h1 {      max-width: 1200px;  } +#cr { +    opacity: var(--opacity-cr); +} +  #jf { -    /*position: absolute;*/ +    opacity: var(--opacity-jf); +} + +.text-highlight { +    text-decoration: underline; +    color: var(--highlight-color);  }  #right { -    max-width: 500px; +    max-width: 450px;      max-height: 500px;      display: flex;      justify-content: center; @@ -33,6 +41,6 @@ h1 {  }  #left { -    max-width: 500px; +    max-width: 550px;      z-index: 1;  } diff --git a/ufund-ui/src/app/components/home-page/home-page.component.html b/ufund-ui/src/app/components/home-page/home-page.component.html index 7a7ff96..051132e 100644 --- a/ufund-ui/src/app/components/home-page/home-page.component.html +++ b/ufund-ui/src/app/components/home-page/home-page.component.html @@ -1,10 +1,14 @@  <div id="hero">      <div id="left"> -        <h1>Helping fund coral reef and marine life conservation</h1> +        <h1>Helping fund <span class="text-highlight">coral reef</span> and  +            <span class="text-highlight">marine life</span> conservation.</h1>          <p>View our online cupboard holding all needs related to sea life preservation</p> -        <button class="button2" routerLink="/cupboard">View needs</button> +        <button class="button2" routerLink="/cupboard">View Needs</button>      </div>      <div id="right"> -        <img id="jf" src="jf.png" height="1024" width="1024"/> +        <!-- <img id="jf" src="jf.png" height="1024" width="1024"/> --> +         <div style="width: 500px; height: 500px;"></div> +        <img style="position: absolute;" id="cr" src="cr.png" height="700" width="700"/> +        <img style="position: absolute;" id="jf" src="jf.png" height="700" width="700"/>      </div>  </div> diff --git a/ufund-ui/src/app/components/home-page/home-page.component.ts b/ufund-ui/src/app/components/home-page/home-page.component.ts index 95e8962..71c2549 100644 --- a/ufund-ui/src/app/components/home-page/home-page.component.ts +++ b/ufund-ui/src/app/components/home-page/home-page.component.ts @@ -1,4 +1,5 @@ -import {Component} from '@angular/core'; +import {Component, Inject, OnInit} from '@angular/core'; +import { DOCUMENT } from '@angular/common';  @Component({      selector: 'app-home-page', @@ -6,6 +7,17 @@ import {Component} from '@angular/core';      templateUrl: './home-page.component.html',      styleUrl: './home-page.component.css'  }) -export class HomePageComponent { +export class HomePageComponent implements OnInit { + +    constructor( +        @Inject(DOCUMENT) private document: Document +    ) {} +    ngOnInit(): void { +        console.log(this.document.documentElement); +    } + +     + +      } diff --git a/ufund-ui/src/index.html b/ufund-ui/src/index.html index b6ae1a2..34b631c 100644 --- a/ufund-ui/src/index.html +++ b/ufund-ui/src/index.html @@ -1,5 +1,5 @@  <!doctype html> -<html lang="en"> +<html lang="en" theme="light">  <head>      <meta charset="utf-8">      <title>UfundUi</title> diff --git a/ufund-ui/src/styles.css b/ufund-ui/src/styles.css index 75d6b36..a1902fd 100644 --- a/ufund-ui/src/styles.css +++ b/ufund-ui/src/styles.css @@ -1,17 +1,38 @@  /* You can add global styles to this file, and also import other style files */  :root { -    color-scheme: /*light*/ dark; +    color-scheme: dark;  }  * {      box-sizing: border-box; +    color: var(--foreground-color); +    transition: all ease-in-out .3s; +} + +[theme="light"] { +    --background-color: #e6e4df; +    --foreground-color: #000000; +    --highlight-color: #cf9451; +    --hover-color: #d8cdc0; +    --opacity-cr: 1; +    --opacity-jf: 0; +} + +[theme="dark"] { +    --background-color: #000715; +    --foreground-color: #ffffff; +    --highlight-color: #6091e8; +    --hover-color: #394559; +    --opacity-cr: 0; +    --opacity-jf: 1;  }  html, body {      margin: 0;      height: 100%; -    background-color: light-dark(white, #000715); +    background-color: var(--background-color); +    color: var(--foreground-color);  }  body { @@ -25,37 +46,39 @@ input {      border-radius: 5px;      border-style: solid;      border-width: 1px; -    background-color: light-dark(#ebebeb, #3a3a3a); +    background-color: var(--background-color);      &:hover { -        background-color: light-dark(#e1e1e1, #444444); +        background-color: var(--hover-color);      }  }  button, input[type=button], input[type=reset], input[type=submit], .button { -    font-size: 14pt; +    font-size: 12pt;      padding: 6px 16px;      border-radius: 9999px;      border-style: none; -    background-color: light-dark(#ebebeb, #3a3a3a); +    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +    background-color: var(--background-color);      display: flex;      gap: 5px;      text-align: center;      justify-content: center;      &:hover { -        background-color: light-dark(#e1e1e1, #444444); +        background-color: var(--hover-color);      }  }  .button2 { -    text-transform: uppercase; -    border: 1px solid #5cdbff; +    /* text-transform: uppercase; */ +    border: 3px solid var(--highlight-color);      padding: 10px 25px; +    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;      font-size: 12pt; -    font-weight: 600; +    font-weight: 700;      background-color: transparent; -    text-shadow: #5cdbff 0 0 50px; +    text-shadow: var(--highlight-color) 0 0 50px;  }  .icon {  | 
