image-mosaic

by rgarciadelongoria

HTML

<script src="https://unpkg.com/@rgarciadelongoria/image-mosaic@0.0.5/src/image-mosaic.js"></script>
<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ejemplo Básico</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <section>
        <h1>image-mosaic</h1>
        <h2>Web Component to display a mosaic of images</h2>
        <p>With this component you can display from 1 to 4 mosaic of images.</p>
        <p>The default appearance of each mosaic depends on the number of images.</p>
        <article class="example-column">
            <image-mosaic class="custom-image-mosaic"
                image1="https://picsum.photos/id/152/400/400"
                image2="https://picsum.photos/id/159/400/400"
                image3="https://picsum.photos/id/175/400/400"
                image4="https://picsum.photos/id/237/400/400">
            </image-mosaic>
            <pre>
                <code>
&lt;image-mosaic
image1="https://picsum.photos/id/152/400/400"
image2="https://picsum.photos/id/159/400/400"
image3="https://picsum.photos/id/175/400/400"
image4="https://picsum.photos/id/237/400/400"&gt;
&lt;/image-mosaic&gt;
                </code>
            </pre>
            <image-mosaic class="custom-image-mosaic"
                image1="https://picsum.photos/id/152/400/400"
                image2="https://picsum.photos/id/159/400/400"
                image3="https://picsum.photos/id/175/400/400">
            </image-mosaic>
            <pre>
                <code>
&lt;image-mosaic
image1="https://picsum.photos/id/152/400/400"
image2="https://picsum.photos/id/159/400/400"
image3="https://picsum.photos/id/175/400/400"&gt;
&lt;/image-mosaic&gt;
                </code>
            </pre>
            <image-mosaic class="custom-image-mosaic"
                image1="https://picsum.photos/id/152/400/400"
               ...

CSS

@font-face {
    font-family: Montserrat;
    font-style: regular;
    src: url('/font/Montserrat-Regular.ttf');
    font-weight: 400;
}

@font-face {
    font-family: Montserrat;
    font-style: black;
    src: url('/font/Montserrat-Black.ttf');
    font-weight: 900;
}

@font-face {
    font-family: Montserrat;
    font-style: medium;
    src: url('/font/Montserrat-Medium.ttf');
    font-weight: 500;
}

@font-face {
    font-family: Montserrat;
    font-style: regular;
    src: url('/font/Montserrat-Bold.ttf');
    font-weight: 700;
}

h1, h2, p {
    font-family: Montserrat, sans-serif !important;
}

pre {
    background-color: #353535;
    border-radius: 8px;
    padding: 8px;
    width: calc(100% - 16px);
    overflow: auto;
}

code {
    color: #f4f4f4;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

body {
    background-color: white;
}

h1 {
    font-size: 2.5em;
    font-weight: 900;
}

.example-row {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
}

.example-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-image-mosaic {
    width: 220px;
    height: 220px;
}