Skip to content

Commit 0ab7015

Browse files
authored
feat(web): server logo with pre-defined placements(in the config) (#4)
1 parent 5c97edf commit 0ab7015

5 files changed

Lines changed: 46 additions & 2 deletions

File tree

web/assets/images/logo.png

50.3 KB
Loading

web/assets/script.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {
22
TIP_CHANGE_INTERVAL,
33
BACKGROUND_CHANGE_INTERVAL,
44
BACKGROUND_IMAGES,
5-
ENABLE_CURSOR
5+
ENABLE_CURSOR,
6+
SERVER_LOGO_POSITION
67
} from '../config.js'
78

89
import { parsedMdTips } from "./markdown_parser.js";
@@ -19,6 +20,7 @@ const hintHelpTxtEl = $('#hint-help-text')
1920
const containerEL = $('#container')
2021
const bgImgEl = $('#bgImg')
2122
const spinnerEl = $('#spinner')
23+
const logoEl = $('#server-logo')
2224

2325

2426
// We store the current tipInterval if any here
@@ -119,11 +121,19 @@ const startBackgroundInterval = () => {
119121
}, BACKGROUND_CHANGE_INTERVAL)
120122
}
121123

124+
/*
125+
Set Initial element class for server logo placement
126+
*/
127+
const setServerLogoPosition = () => {
128+
logoEl.addClass(SERVER_LOGO_POSITION)
129+
}
130+
122131
/* Listeners */
123132

124133
window.addEventListener('DOMContentLoaded', () => {
125134
startBackgroundInterval()
126135
setRandomTip()
136+
setServerLogoPosition()
127137
spinnerEl.fadeIn()
128138
})
129139

web/assets/styles.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,36 @@ a[onclick] {
7373
position: absolute;
7474
}
7575

76+
#server-logo {
77+
background: url("./images/logo.png");
78+
background-repeat: no-repeat;
79+
background-size: contain;
80+
position: absolute;
81+
width: 15vh;
82+
height: 15vh;
83+
z-index: 2;
84+
}
85+
86+
#server-logo.top-left {
87+
top: 2.5vh;
88+
left: 2.5vh;
89+
}
90+
91+
#server-logo.top-right {
92+
top: 2.5vh;
93+
right: 2.5vh;
94+
}
95+
96+
#server-logo.bottom-right {
97+
bottom: 2.5vh;
98+
right: 2.5vh;
99+
}
100+
101+
#server-logo.center {
102+
top: 50%;
103+
transform: translateY(-50%);
104+
}
105+
76106
.header-container {
77107
display: flex;
78108
justify-content: space-between;

web/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,7 @@ export const BACKGROUND_IMAGES = [
4747
export const ENABLE_CURSOR = true
4848

4949
// Enable github flavored markdown
50-
export const ENABLE_GFM_MARKDOWN = false
50+
export const ENABLE_GFM_MARKDOWN = false
51+
52+
// Define server logo placement ['top-left', 'top-right', 'bottom-right', 'center']
53+
export const SERVER_LOGO_POSITION = 'center'

web/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<div id="container">
1717
<div id="cursor"></div>
1818
<div id="bgImg"></div>
19+
<div id="server-logo"></div>
1920
<div id="tip-container">
2021
<div class="header-container">
2122
<div class="header-text" id="tip-header"></div>

0 commit comments

Comments
 (0)