Skip to content

Commit

Permalink
enh(wall): move styles to theme
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed Oct 25, 2024
1 parent 5a64d98 commit 7bf73c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/apps/seelen_wall/modules/wallpaper/infra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,13 @@ export function Wallpaper({ path, containerRef, onLoad, onError }: Props) {
}, [stoped]);

if (['.png', '.jpg', '.jpeg', '.webp', '.gif'].some((ext) => path.endsWith(ext))) {
wallpaper = (
<img
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
src={convertFileSrc(path)}
onLoad={onLoad}
onError={onError}
/>
);
wallpaper = <img src={convertFileSrc(path)} onLoad={onLoad} onError={onError} />;
}

if (['.mp4', '.mkv', '.wav'].some((ext) => path.endsWith(ext))) {
wallpaper = (
<video
ref={videoRef}
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
src={convertFileSrc(path)}
onLoadedData={onLoad}
onError={onError}
Expand All @@ -59,5 +51,9 @@ export function Wallpaper({ path, containerRef, onLoad, onError }: Props) {
);
}

return <div ref={containerRef}>{wallpaper}</div>;
return (
<div ref={containerRef} className="wallpaper-container">
{wallpaper}
</div>
);
}
12 changes: 12 additions & 0 deletions static/themes/default/theme.wall.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@
mask-size: cover;
}
}

.wallpaper-container {
width: 100%;
height: 100%;

img,
video {
width: 100%;
height: 100%;
object-fit: cover;
}
}

0 comments on commit 7bf73c3

Please sign in to comment.