Skip to content

Commit

Permalink
use icon font to avoid SVG cross-domain restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachughes committed Jul 14, 2023
1 parent 5e6b99f commit a8836f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
8 changes: 1 addition & 7 deletions sourcecode/hub/resources/css/app.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
@import "bootstrap/scss/bootstrap";
@import '@fontsource/lato';
@import 'bootstrap-icons/font/bootstrap-icons.css';

:root {
--bs-font-sans-serif: Lato, sans-serif;
}

.bi {
display: inline-block;
vertical-align: -0.125em;
width: 1em;
height: 1em;
}
12 changes: 3 additions & 9 deletions sourcecode/hub/resources/views/components/icon.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
@php use Illuminate\Support\Facades\Vite; @endphp
<svg {{ $attributes->except(['name', 'label'])->merge([
'class' => 'bi',
'width' => 16,
'height' => 16,
'fill' => 'currentColor',
<span {{ $attributes->except(['name', 'label'])->merge([
'class' => 'bi bi-' . $name,
...(isset($label) ? [
'aria-label' => $label,
'role' => 'img',
] : [
'aria-hidden' => 'true',
]),
]) }}>
<use xlink:href="{{ Vite::asset('node_modules/bootstrap-icons/bootstrap-icons.svg') }}#{{ $name }}" />
</svg>
]) }}></span>

0 comments on commit a8836f3

Please sign in to comment.