示例#1
0
def image(props: Props) -> Element:
    return DOM.create_element('img', {
        'src': props.get('src'),
        'width': props.get('width'),
        'height': props.get('height'),
        'alt': props.get('alt'),
    })
def image(props: Props) -> Element:
    return DOM.create_element(
        "img",
        {
            "src": props.get("src"),
            "width": props.get("width"),
            "height": props.get("height"),
            "alt": props.get("alt"),
        },
    )
示例#3
0
def button(props: Props) -> Element:
    href = props.get('href', '#')
    icon_name = props.get('icon', None)
    text = props.get('text', '')

    return DOM.create_element(
        'a',
        {'class': 'icon-text' if icon_name else None, 'href': href},
        DOM.create_element(icon, {'name': icon_name}) if icon_name else None,
        DOM.create_element('span', {'class': 'icon-text__text'}, text) if icon_name else text
    )
def button(props: Props) -> Element:
    href = props.get("href", "#")
    icon_name = props.get("icon", None)
    text = props.get("text", "")

    return DOM.create_element(
        "a",
        {
            "class": "icon-text" if icon_name else None,
            "href": href
        },
        DOM.create_element(icon, {"name": icon_name}) if icon_name else None,
        DOM.create_element("span", {"class": "icon-text__text"}, text)
        if icon_name else text,
    )
示例#5
0
def icon(props: Props) -> Element:
    href = '#icon-%s' % props.get('name', '')
    return DOM.create_element('svg', {'class': 'icon'}, DOM.create_element('use', {'xlink:href': href}))