summaryrefslogblamecommitdiffstats
path: root/tpl/objects/button.pug
blob: 0884c8d0c631acf607f4883d12d2b1fcae818ab5 (plain) (tree)
1
2
3
4
5
6
7
8



                                                  
                                                    
                                                    
                                                            


                                                             

                                                          

                                                    
                                                                                               
                          
                                  
                 




                                      
mixin a-button
    -
        let classes = {
            'o-button':          true,
            'o-button--block':   attributes.block,
            'o-button--primary': attributes.primary,
            'o-button--outline': attributes.outline,
            'o-button--round':   !!attributes.icon && !block
        }
        if (attributes.variant) {
            classes['o-button--' + attributes.variant] = true
        }
        if (attributes.size) {
            classes['o-button--' + attributes.size] = true
        }

        let href = attributes.disabled ? null : '#';

    a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled))
        if attributes.icon
            +icon(attributes.icon)
            = ' '
        if block
            span.o-button__label
                block
        if attributes.postIcon
            = ' '
            +icon(attributes.postIcon)