Skip to content

Commit

Permalink
Add background and scale the font size
Browse files Browse the repository at this point in the history
  • Loading branch information
Pezmc committed May 24, 2024
1 parent eb747e3 commit 8efeed3
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
Binary file added temporary-sign/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion temporary-sign/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
<template v-else> {{ status }} </template>
</div>
<template v-if="structure">
<h1 :style="{fontSize: `${structure.fontSize}px` }">{{structure.Structure}}</h1>
<div class="name">
<h1 :style="{fontSize: `${structure.fontSize}px` }">{{structure.Structure}}</h1>
</div>

<div class="furniture" v-if="structure.Furniture">
<h2>Furniture</h2>
Expand Down
32 changes: 25 additions & 7 deletions temporary-sign/temporary-sign.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,34 @@ body {
height: 700px;
padding: 4px;
position: relative;
background: #ffffff url(background.png) center center/cover no-repeat;
display: flex;
flex-direction: column;
}

.name {
display: flex;
justify-content: center;
overflow: hidden;
text-overflow: ellipsis;
flex-grow: 1;
padding: 20px;
flex-direction: column;
align-items: center;
}

.furniture {
bottom: 0;
left: 0;
justify-self: flex-end;
margin-right: 275px;
padding: 0 20px 10px 20px;
background: rgba(255, 255, 255, 0.8);
}

h1 {
text-align: center;
margin: 0px;
}

h2 {
Expand Down Expand Up @@ -70,13 +94,7 @@ tbody tr:nth-child(odd) {
background-color: #f0f0f0;
}

.furniture {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
padding: 4px 10px;
}


.qrcode img {
display: block;
Expand Down
18 changes: 17 additions & 1 deletion temporary-sign/temporary-sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,23 @@ const normalizeBetweenTwoRanges = (val, minVal, maxVal, newMin, newMax) => {


function scaleFont(words) {
return normalizeBetweenTwoRanges(words.length, 0, 100, 256, 10)
if (words.length < 10) {
return 256
}

if (words.length < 20) {
return 170
}

if (words.length < 30) {
return 150
}

if (words.length < 40) {
return 125
}

return normalizeBetweenTwoRanges(words.length, 0, 80, 256, 100)
}

function tweakUrl(url) {
Expand Down

0 comments on commit 8efeed3

Please sign in to comment.