You can create a mixin as a function.


myMixin : Style.Model -> Style.Model
myMixin style =
    { style
        | visibility = hidden
    }

myMixinColor : Style.Model -> Style.Model
myMixinColor style =
    { style
        | colors = palette.blue
    }


dropDown : List (Html.Attribute a) -> List (Element a) -> Element a
dropDown =
    element
        ({ base
            | width = px 300
            , padding = all 20
            , spacing = topBottom 40
         }
            |> myMixin
            |> myMixinColor
        )










On Monday, October 31, 2016 at 5:16:43 AM UTC-4, Ed Ilyin wrote:
>
> I'm actively using Polymer Paper Elements. And they accept mixings like 
> this:
> ```css
>       paper-dropdown-menu {
>         --paper-input-container-input: {
>           color: white;
>         }
>         --paper-input-container-underline: {
>           display: none;
>         }
>         --paper-dropdown-menu-icon: {
>           color: white;
>         }
>         --paper-input-container-focus-color: white;
>       }
> ```
> how to do the same using style-elements library?
>
> Il giorno ven 28 ott 2016 alle ore 19:34 Matthew Griffith <
> [email protected] <javascript:>> ha scritto:
>
>> So, taking a look at it, direct support for keyed will be super easy and 
>> will absolutely show up in v1.1.0.
>>
>> And I believe I have a way to directly support lazy as well, though I 
>> want to try it out before confirming completely.
>>
>>
>>
>>
>> On Friday, October 28, 2016 at 12:28:17 PM UTC-4, Mark Hamburg wrote:
>>
>>> On Oct 28, 2016, at 7:28 AM, Matthew Griffith <[email protected]> 
>>> wrote:
>>>
>>> 2.  You can use Keyed and Lazy on a parent element (the one created by 
>>> *Style.Elements.build*).  You could use *Style.Elements.build* in a 
>>> child view and then use *Style.Elements.html *to integrate it into the 
>>> main view, using keyed or lazy in the process.   That feels a bit 
>>> roundabout and I believe there could be a better way.  I'll just have to 
>>> give it some thought as to how it'd work :).   
>>>
>>>
>>> Keyed as it turns out is central to getting stateful DOM elements to 
>>> behave reliably.
>>>
>>> But I'm looking forward to trying this library out.
>>>
>>> Mark
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Elm Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to