feat(components/tiles/pages): image page
This commit is contained in:
parent
6adbeec8d5
commit
fa6e1613f2
6 changed files with 40 additions and 10 deletions
BIN
src/lib/assets/images/test-rectangle.webp
Normal file
BIN
src/lib/assets/images/test-rectangle.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
BIN
src/lib/assets/images/test-square.webp
Normal file
BIN
src/lib/assets/images/test-square.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
|
|
@ -7,9 +7,14 @@ Metro-like tile. Must be in a group to display correctly.
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { cva } from "class-variance-authority";
|
import { cva } from "class-variance-authority";
|
||||||
|
|
||||||
// Base size for a icon in pixels.
|
/**
|
||||||
|
* Base size for a icon in pixels.
|
||||||
|
**/
|
||||||
const ICON_BASE_SIZE = 45;
|
const ICON_BASE_SIZE = 45;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties.
|
||||||
|
*/
|
||||||
let {
|
let {
|
||||||
size,
|
size,
|
||||||
row,
|
row,
|
||||||
|
|
@ -45,7 +50,7 @@ Metro-like tile. Must be in a group to display correctly.
|
||||||
size: {
|
size: {
|
||||||
small: ["row-span-1", "col-span-1"],
|
small: ["row-span-1", "col-span-1"],
|
||||||
medium: ["row-span-2", "col-span-2"],
|
medium: ["row-span-2", "col-span-2"],
|
||||||
wide: ["row-span-4", "col-span-2"],
|
wide: ["row-span-2", "col-span-4"],
|
||||||
large: ["row-span-4", "col-span-4"],
|
large: ["row-span-4", "col-span-4"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Icon page for a tile. Must be in a tile to display correctly.
|
||||||
name,
|
name,
|
||||||
}: {
|
}: {
|
||||||
/**
|
/**
|
||||||
* Icon. Must be a valid image URL.
|
* Icon. Must be a valid URL.
|
||||||
*/
|
*/
|
||||||
icon: string;
|
icon: string;
|
||||||
|
|
||||||
21
src/lib/components/tiles/pages/TileImagePage.svelte
Normal file
21
src/lib/components/tiles/pages/TileImagePage.svelte
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
|
||||||
|
Image page for a tile. Must be in a tile to display correctly.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
let {
|
||||||
|
image,
|
||||||
|
}: {
|
||||||
|
/**
|
||||||
|
* Image. Must be a valid image URL.
|
||||||
|
*/
|
||||||
|
image: string;
|
||||||
|
} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="w-full h-full bg-cover bg-center bg-no-repeat"
|
||||||
|
style="background-image: url('{image}');"
|
||||||
|
></div>
|
||||||
|
|
@ -1,22 +1,26 @@
|
||||||
<script>
|
<script>
|
||||||
import iconSynzr from "$lib/assets/icons/synzr.webp";
|
import iconSynzr from "$lib/assets/icons/synzr.webp";
|
||||||
|
|
||||||
|
import imageTestRectangle from "$lib/assets/images/test-rectangle.webp";
|
||||||
|
import imageTestSquare from "$lib/assets/images/test-square.webp";
|
||||||
|
|
||||||
import Tile from "$lib/components/tiles/Tile.svelte";
|
import Tile from "$lib/components/tiles/Tile.svelte";
|
||||||
import TileGroup from "$lib/components/tiles/TileGroup.svelte";
|
import TileGroup from "$lib/components/tiles/TileGroup.svelte";
|
||||||
import TileIconPage from "$lib/components/tiles/TileIconPage.svelte";
|
import TileIconPage from "$lib/components/tiles/pages/TileIconPage.svelte";
|
||||||
|
import TileImagePage from "$lib/components/tiles/pages/TileImagePage.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TileGroup title="a lot of mikhails" rows={3} columns={3}>
|
<TileGroup title="a lot of mikhails" rows={3} columns={3}>
|
||||||
<Tile size="small" row={5} column={2}>
|
<Tile size="small" row={5} column={2}>
|
||||||
<TileIconPage icon={iconSynzr} />
|
<TileIconPage icon={iconSynzr} name="mikhail" />
|
||||||
</Tile>
|
|
||||||
<Tile size="large" row={1} column={1}>
|
|
||||||
<TileIconPage icon={iconSynzr} name="synzr" />
|
|
||||||
</Tile>
|
</Tile>
|
||||||
<Tile size="medium" row={3} column={5}>
|
<Tile size="medium" row={3} column={5}>
|
||||||
<TileIconPage icon={iconSynzr} name="synzr" />
|
<TileIconPage icon={iconSynzr} name="mikhail" />
|
||||||
</Tile>
|
</Tile>
|
||||||
<Tile size="wide" row={5} column={3}>
|
<Tile size="wide" row={5} column={3}>
|
||||||
<TileIconPage icon={iconSynzr} name="synzr" />
|
<TileImagePage image={imageTestRectangle} />
|
||||||
|
</Tile>
|
||||||
|
<Tile size="large" row={1} column={1}>
|
||||||
|
<TileImagePage image={imageTestSquare} />
|
||||||
</Tile>
|
</Tile>
|
||||||
</TileGroup>
|
</TileGroup>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue