1
0
mirror of https://github.com/kognise/water.css.git synced 2025-08-18 10:51:29 +02:00

feat: add tooltip styling, make options expandable, general fixes

This commit is contained in:
Jonas Kuske
2019-06-07 15:03:26 +02:00
parent 893b8ab4ed
commit afcf059863
2 changed files with 75 additions and 33 deletions

View File

@@ -6,29 +6,56 @@ html {
margin-top: 1rem; margin-top: 1rem;
} }
#installation { .version-select {
overflow: hidden; overflow: hidden;
} }
#installation header > h3 {
.version-select__snippet h3 {
margin: 1rem 2.5rem 1rem 0; margin: 1rem 2.5rem 1rem 0;
} }
/* Make the ✔ / ❌ Emoji appear next to the button */ /* Make the ✔ / ❌ Emoji appear next to the button */
#installation header button { .version-select__snippet__btn {
position: relative; position: relative;
margin-left: auto; margin: 0 2px 0 auto;
overflow: visible; overflow: visible;
} }
#installation header button span { .version-select__snippet__btn span {
position: absolute; position: absolute;
left: -2rem; left: -2rem;
display: inline-block; display: inline-block;
transform: scale(1.3); transform: scale(1.3);
} }
.version-select__options {
margin-right: 1rem;
}
.version-select__options > label {
white-space: pre;
}
.version-select__options__additional > * {
margin-top: 1rem;
display: inline-block;
}
.version-select__options__additional summary {
display: block;
cursor: pointer;
font-weight: 600;
}
.version-select__options__additional summary:focus {
outline: none;
}
.version-select__options__additional summary:focus span {
text-decoration: underline;
}
/* Fixed layout so columns don't jump when content changes */ /* Fixed layout so columns don't jump when content changes */
#installation table { .version-select__info {
table-layout: fixed; table-layout: fixed;
} }
#installation table th { .version-select__info caption {
text-align: left;
}
.version-select__info th {
border: none; border: none;
vertical-align: top; vertical-align: top;
width: 35%; width: 35%;
@@ -58,6 +85,19 @@ body > footer {
.translucent { .translucent {
opacity: 0.4; opacity: 0.4;
} }
.tooltip {
position: relative;
cursor: help;
}
.tooltip::after {
content: '';
position: absolute;
left: 0;
bottom: -4px;
width: 100%;
border-width: 0 0 1.5px;
border-style: dotted;
}
/* For the bounce transitions of code snippet and copy success Emoji */ /* For the bounce transitions of code snippet and copy success Emoji */
.v-enter, .v-enter,

View File

@@ -1,8 +1,8 @@
<!-- Start interactive version picker --> <!-- Start interactive version picker -->
<div id="installation" v-cloak> <div id="installation" class="version-select" v-cloak>
<header class="row"> <header class="row version-select__snippet">
<h3>Paste this into the <code>&lt;head&gt;</code> of your HTML:</h3> <h3>Paste this into the <code>&lt;head&gt;</code> of your HTML:</h3>
<button type="button" @click="copyToClipboard"> <button type="button" class="version-select__snippet__btn" @click="copyToClipboard">
<transition> <transition>
<span v-if="copyStatus === 'success'" class="emoji"></span> <span v-if="copyStatus === 'success'" class="emoji"></span>
<span v-else-if="copyStatus === 'failed'" class="emoji"></span> <span v-else-if="copyStatus === 'failed'" class="emoji"></span>
@@ -15,44 +15,47 @@
<pre :key="selectedVersion.fileSnippet"><code>{{selectedVersion.fileSnippet}}</code></pre> <pre :key="selectedVersion.fileSnippet"><code>{{selectedVersion.fileSnippet}}</code></pre>
</transition> </transition>
<h3>Version options:</h3> <h3>Options</h3>
<form action="./" method="post" @submit.prevent> <form action="./" method="post" @submit.prevent class="version-select__options">
<label> <label>
<input type="radio" value="dark" checked name="theme" v-model="versionOptions.theme" /> <input type="radio" value="dark" checked name="theme" v-model="versionOptions.theme" />
Dark theme&nbsp;<span class="emoji">🌙</span> Dark theme&nbsp;<span class="emoji">🌙</span>
<span <span
v-if="!versionOptions.isStandalone" v-if="!versionOptions.isStandalone"
class="emoji translucent" class="tooltip emoji translucent"
title="Selected theme may be overwritten by theme settings on user's device" title="Selected theme may be overwritten by theme settings on user's device"
> >
/ ☀ / ☀</span>
</span>
</label> </label>
<label> <label>
<input type="radio" value="light" name="theme" v-model="versionOptions.theme" /> <input type="radio" value="light" name="theme" v-model="versionOptions.theme" />
Light theme&nbsp;<span class="emoji"></span> Light theme&nbsp;<span class="emoji"></span>
<span <span
v-if="!versionOptions.isStandalone" v-if="!versionOptions.isStandalone"
class="emoji translucent" class="tooltip emoji translucent"
title="Selected theme may be overwritten by theme settings on user's device" title="Selected theme may be overwritten by theme settings on user's device"
> >
/ 🌙 / 🌙</span>
</span>
</label>
<br /><br />
<label>
<input type="checkbox" checked v-model="versionOptions.isStandalone" />
Enforce theme? (ignore <code>prefers-color-scheme</code>)
</label>
<br /><br />
<label>
<input type="checkbox" v-model="versionOptions.isLegacy" />
Support Internet Explorer and other legacy browsers?
</label> </label>
<details class="version-select__options__additional">
<summary><span>Additional options</span></summary>
<label>
<input type="checkbox" checked v-model="versionOptions.isStandalone" />
Enforce theme? (ignore <code>prefers-color-scheme</code>)
</label>
<br />
<label>
<input type="checkbox" v-model="versionOptions.isLegacy" />
Support Internet Explorer and other legacy browsers?
</label>
</details>
</form> </form>
<h3>Version info:</h3> <table class="version-select__info">
<table> <caption>
<h3>Version info</h3>
</caption>
<tbody> <tbody>
<tr> <tr>
<th>File</th> <th>File</th>
@@ -104,8 +107,7 @@
</template> </template>
<template v-else> <template v-else>
All current browsers (<a href="https://caniuse.com/#feat=css-variables" All current browsers (<a href="https://caniuse.com/#feat=css-variables"
>support for CSS Custom Properties</a >support for CSS Custom Properties</a>)
>)
</template> </template>
</td> </td>
</tr> </tr>