Skip to content

Commit

Permalink
Improve image performance
Browse files Browse the repository at this point in the history
  • Loading branch information
HudsonGraeme committed Jun 22, 2023
1 parent 37688ab commit 0d634cd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import Blog from './Pages/Blog'
import BlogPost from './Pages/BlogPost'
import Home from './Pages/Home'
import './styles.css'

function App() {
const App = () => {
return (
<HopeProvider
config={{
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { createEffect, createSignal, For, Show } from 'solid-js'
import { toDataURL } from '../utilities'
import Crash from './Asset/crash'
import Loading from './Asset/Loading'

const Image = ({ src, alt, ...otherProps }: ImageProps) => {
const [loaded, setLoaded] = createSignal(false)
const [error, setError] = createSignal(false)
Expand Down Expand Up @@ -147,6 +148,7 @@ const Image = ({ src, alt, ...otherProps }: ImageProps) => {
</Modal>
<Show when={!error()}>
<HopeImage
loading="lazy"
src={dataURL()}
onLoad={() => setLoaded(true)}
onError={() => setError(true)}
Expand Down
5 changes: 5 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* {
box-sizing: border-box;
scroll-behavior: smooth;
}

td {
Expand Down Expand Up @@ -32,3 +33,7 @@ table {
border-spacing: 0 15px !important;
border-radius: 1rem !important;
}

img {
will-change: transform;
}

0 comments on commit 0d634cd

Please sign in to comment.