garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

.. /web/src/components/icons.tsx

raw

import m from '@garage44/mithril'

/**
 * Line icons in the text's colour, as the rest of the page has them: an emoji
 * brings its own colours, and a phone's font draws it at a weight of its own.
 * Each sits on the text's line (`.line-icon`), and is drawn fresh at each use:
 * one vnode in two places is one DOM node.
 */
const line = (...paths: m.Children[]) => (
    <svg class="line-icon" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">
        {paths}
    </svg>
)

export const icon = {
    trash: () => line(<path d="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9.5h6.6L12 4M6.8 6.5v4.5M9.2 6.5v4.5" />),
    pencil: () => line(<path d="M10.5 2.5l3 3L6 13H3v-3l7.5-7.5zM9 4l3 3" />),
    /** Carrying on later: a time set (sessions.rs, `wake`). */
    clock: () => line(<circle cx="8" cy="8" r="5.75" />, <path d="M8 4.75V8l2.25 1.5" />),
    key: () => line(<circle cx="5" cy="11" r="2.5" />, <path d="M6.8 9.2L13 3M10.5 5.5l1.75 1.75M9 7l1.25 1.25" />),
}