Skip to content
Snippets Groups Projects
Commit c3656e32 authored by Dominic Meiser's avatar Dominic Meiser Committed by Thomas Schneider
Browse files

Unify the .select/.option stuff

parent 37c69191
Branches
Tags
1 merge request!3A bunch of design stuff
// the threshold at which we consider the screen "mobile" // the threshold at which we consider the screen "mobile"
@mobile_threshold: 700px; @mobile_threshold: 700px;
// the border around the preview (per color) // the border around the options in the fieldset-select-like things
@preview_border: .3rem; @option_border: .3rem;
// the minimum size of the left area in the form layout // the minimum size of the left area in the form layout
@label-width: 90px; @label-width: 90px;
...@@ -17,6 +17,7 @@ body { ...@@ -17,6 +17,7 @@ body {
// adjust colors for light theme here // adjust colors for light theme here
--bg: #fff; --bg: #fff;
--fg: #000; --fg: #000;
--fg-dark: #bbb;
--accent: #80f; --accent: #80f;
--accent2: #c4f; --accent2: #c4f;
...@@ -24,6 +25,7 @@ body { ...@@ -24,6 +25,7 @@ body {
// adjust colors for dark theme here // adjust colors for dark theme here
--bg: #222; --bg: #222;
--fg: #fff; --fg: #fff;
--fg-dark: #888;
} }
} }
...@@ -40,7 +42,7 @@ body, @{inputs}, @{buttons} { ...@@ -40,7 +42,7 @@ body, @{inputs}, @{buttons} {
} }
@{inputs}, @{buttons}, fieldset { @{inputs}, @{buttons}, fieldset {
border: .15rem solid var(--fg); border: .15rem solid var(--fg-dark);
border-radius: .25rem; border-radius: .25rem;
} }
...@@ -163,13 +165,6 @@ main { ...@@ -163,13 +165,6 @@ main {
width: min(95vw, 100rem); width: min(95vw, 100rem);
/* A4 aspect ratio: √2:1 */ /* A4 aspect ratio: √2:1 */
aspect-ratio: 1.4142135623730951; aspect-ratio: 1.4142135623730951;
border: @preview_border solid var(--bg);
padding: @preview_border;
&.preview-small {
width: 15rem;
}
} }
.preview-label { .preview-label {
...@@ -180,11 +175,12 @@ main { ...@@ -180,11 +175,12 @@ main {
.box { .box {
display: grid; display: grid;
grid-template-columns: min(@label-width, auto) 1fr; grid-template-columns: min(@label-width, auto) 1fr;
align-items: start; align-items: baseline;
label.for-text { label.for-text {
display: inline-block; display: inline-block;
justify-self: end; justify-self: end;
font-size: 1.1rem;
} }
input[type = "text"], textarea { input[type = "text"], textarea {
...@@ -208,51 +204,59 @@ main { ...@@ -208,51 +204,59 @@ main {
gap: 1ch; gap: 1ch;
} }
fieldset { // these are the fieldsets containing select-like options modeled with radio buttons
.select {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 2 * @preview_border; gap: 2 * @option_border;
}
fieldset > div { .option {
display: flex; display: flex;
gap: 0.5rem;
flex-direction: column; flex-direction: column;
gap: .5rem;
.preview {
width: 15rem;
} }
.imageselect > div { img {
width: 10rem; width: 10rem;
display: flex; background-color: #fff;
gap: 0.5rem;
} }
fieldset label { .option-border {
flex-grow: 1; border: @option_border solid var(--fg-dark);
} border-radius: 3 * @option_border;
.imageselect img { // iframe's behave nicely
width: 100%; &.preview {
background-color: #fff; padding: @option_border;
} }
fieldset input { // label>img doesn't
display: none; & > img {
border: @option_border solid var(--bg);
border-radius: 2 * @option_border;
} }
fieldset img,
fieldset iframe,
.preview-small {
border-color: var(--fg);
border-radius: 3 * @preview_border;
} }
input[type = "radio"] { input[type = "radio"] {
&:checked + label > img, display: none;
&:checked + iframe {
&:checked + .option-border {
border-color: var(--accent2); border-color: var(--accent2);
} }
}
&:not(:checked) + iframe { label {
opacity: .8; flex-grow: 1;
// firefox hat hier lack gesoffen und erfindet 5px wenn das hier block oder
// inline ist
display: flex;
}
}
input[type = "radio"] {
display: none;
} }
} }
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<fieldset class="select templateselect"> <fieldset class="select templateselect">
<legend>Vorlage</legend> <legend>Vorlage</legend>
{%- for t in form.template.choices -%} {%- for t in form.template.choices -%}
<div> <div class="option">
<input <input
type="radio" type="radio"
name="template" name="template"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
{%- endif -%} {%- endif -%}
/> />
<iframe <iframe
class="preview preview-small" class="preview option-border"
src="{{ url_for('instance.sample_html', template=t.name) }}" src="{{ url_for('instance.sample_html', template=t.name) }}"
id="template-preview:{{ t.name }}" id="template-preview:{{ t.name }}"
> >
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<fieldset class="select imageselect"> <fieldset class="select imageselect">
<legend>Bild</legend> <legend>Bild</legend>
{%- for img in form.image.choices -%} {%- for img in form.image.choices -%}
<div> <div class="option">
<input <input
type="radio" type="radio"
name="image" name="image"
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
checked checked
{%- endif -%} {%- endif -%}
/> />
<label for="img:{{ img }}"> <label for="img:{{ img }}" class="option-border">
<img src="{{ url_for('instance.static', filename='img/'+img) }}" title="{{ img }}" /> <img src="{{ url_for('instance.static', filename='img/'+img) }}" title="{{ img }}" />
</label> </label>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment