One of the people studying the course pointed out that aspect-ratio is fully supported everywhere, so I've made a change to test it and see how well it's working.

main
Zed A. Shaw 2 years ago
parent 47f4e0c7e9
commit 8f515bf094
  1. 27
      client/components/IconImage.svelte
  2. 6
      rendered/Header.svelte
  3. 2
      rendered/pages/docs/howto/index.svelte
  4. 4
      static/blockstart.css
  5. 24
      static/global.css

@ -27,10 +27,11 @@
<style>
.iconimage-container {
text-align: center;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
text-align: center;
}
.feather {
@ -39,20 +40,18 @@
}
</style>
<div style="--aspect-ratio: { aspect_ratio }; color: {pattern_color || random_pattern}; background-color: {background || random_background}; width: { width }; height: { height }; filter: grayscale({ grayscale });">
<div data-testid={testid} class="pattern-{ pattern } iconimage-container">
<div style="aspect-ratio: { aspect_ratio }; color: {pattern_color || random_pattern}; background-color: {background || random_background}; width: { width }; height: { height }; filter: grayscale({ grayscale });" data-testid={testid} class="pattern-{pattern} iconimage-container">
{#if name}
<svg class="icon-{name} feather"
fill="{fill_color}"
stroke="{color}"
stroke-width="{thickness}"
stroke-linecap="{linecap}"
stroke-linejoin="{linejoin}"
>
<use href="/icon-sprites.svg#{name}"/>
</svg>
<svg class="icon-{name} feather"
fill="{fill_color}"
stroke="{color}"
stroke-width="{thickness}"
stroke-linecap="{linecap}"
stroke-linejoin="{linejoin}"
>
<use href="/icon-sprites.svg#{name}"/>
</svg>
{:else}
<slot></slot>
<slot></slot>
{/if}
</div>
</div>

@ -1,7 +1,5 @@
<script>
import { logout_user } from '$/client/api.js';
import Icon from '$/client/components/Icon.svelte';
import {link} from 'svelte-spa-router';
import { register_enabled } from "$/client/config.js";
export let fixed = false;
@ -46,7 +44,7 @@
<header class:fixed>
<nav>
<a href="/intro/" use:link id="logo">The Bandolier</a>
<a href="/client/#/intro/" id="logo">The Bandolier</a>
<ul>
{#if register_enabled}
<li><a id="register-button" href="/client/#/register/">
@ -60,7 +58,7 @@
</a>
</li>
{/if}
<li><a href="/login/" use:link><Icon color="var(--value7)" name="log-in" tooltip="Log in." /></a></li>
<li><a href="/client/#/login/"><Icon color="var(--value7)" name="log-in" tooltip="Log in." /></a></li>
<li><a href="/client/#/"><Icon color="var(--value7)" name="book" tooltip="Docs" /></a></li>
</ul>
</nav>

@ -49,7 +49,7 @@
<tile>
<left>
<a href="/docs/howto/{ post.metadata.slug }/">
<IconImage width="100%" height="100%" name={ post.metadata.icon } pattern={ false }/>
<IconImage name={ post.metadata.icon } pattern={ false }/>
</a>
</left>
<middle>

@ -238,3 +238,7 @@ button {
button:hover {
filter: brightness(90%);
}
[style*="--aspect-ratio"] {
aspect-ratio: var(--aspect-ratio);
}

@ -1310,27 +1310,11 @@ breadcrumb {
z-index: 10;
}
/* Taken from https://css-tricks.com/aspect-ratio-boxes/#using-custom-properties */
[style*="--aspect-ratio"] > img {
height: auto;
}
/* Testing if this is actually available everywhere. This will go away after a while unless
* I have to fix aspect-ratio. For now it's just for backward compatibility.
*/
[style*="--aspect-ratio"] {
position: relative;
}
[style*="--aspect-ratio"]::before {
content: "";
display: block;
padding-bottom: calc(100% / (var(--aspect-ratio)));
}
[style*="--aspect-ratio"] > :first-child {
width: 100%;
position: absolute;
top: 0;
left: 0;
height: 100%;
aspect-ratio: var(--aspect-ratio);
}
main.centered {

Loading…
Cancel
Save