Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branding via ENV #1

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ name: Docker

on:
push:
branches: [main]
branches: [generic_build]
tags: [v*]
pull_request:
branches: [main]

jobs:
docker:
Expand All @@ -18,7 +16,7 @@ jobs:
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/eth-faucet
images: gatewayfm/eth-faucet-generic:latest
tags: |
type=ref,event=branch
type=ref,event=pr
Expand Down
4 changes: 4 additions & 0 deletions web/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# BRANDING

VITE_LOGO_PATH=/favicon.png
VITE_BACKGROUND_PATH=/background.jpg
4 changes: 4 additions & 0 deletions web/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# BRANDING

VITE_LOGO_PATH=/gpt-logo-white-transparent.svg
VITE_BACKGROUND_PATH=/gpt-background.jpg
Binary file added web/public/gpt-background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions web/public/gpt-logo-white-transparent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 14 additions & 5 deletions web/src/Faucet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
let mounted = false;
let hcaptchaLoaded = false;

const logoPath = import.meta.env.VITE_LOGO_PATH
const backgroundPath = import.meta.env.VITE_BACKGROUND_PATH

onMount(async () => {
const res = await fetch('/api/info');
faucetInfo = await res.json();
Expand Down Expand Up @@ -118,14 +121,14 @@
</svelte:head>

<main>
<section class="hero is-info is-fullheight">
<section class="hero is-info is-fullheight" style='background-image: url({backgroundPath})'>
<div class="hero-head">
<nav class="navbar">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item" href="../..">
<span class="icon">
<i class="fa fa-bath" />
<span class="icon icon-brand">
<img src={logoPath} alt="logo"/>
</span>
<span><b>{faucetInfo.symbol} Faucet</b></span>
</a>
Expand Down Expand Up @@ -187,10 +190,16 @@
</main>

<style>

.icon-brand {
width: 5rem;
margin: 1rem;
}

.hero.is-info {
background:
linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
url('/background.jpg') no-repeat center center fixed;
linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
Expand Down
10 changes: 10 additions & 0 deletions web/src/env/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_LOGO_PATH: string;
readonly VITE_BACKGROUND_PATH: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}