Code Monkey home page Code Monkey logo

Comments (8)

MangelMaxime avatar MangelMaxime commented on August 25, 2024

The element pagination-ellipsis is also a god candidate for this.

Here is how it is implemented in Fulma:

    /// Generate <li><button class="pagination-ellipsis">&hellip;</button></li>
    /// You control the `button` element
    let ellipsis (options: GenericOption list) =
        li [ ]
           [ GenericOptions
                .Parse(options, parseOptions, "pagination-ellipsis")
                .AddProp(DangerouslySetInnerHTML { __html = "&hellip;" })
                .ToReactElement(span) ]

from feliz.bulma.

MangelMaxime avatar MangelMaxime commented on August 25, 2024

When working on #21, I am also adding some tiny abstraction over some of the elements. Only tiny ones when reading the PR we will be to review if all of them make sense of not.

Right now, I am porting everything from Fulma as most of them has been asked by the community over time.

from feliz.bulma.

MangelMaxime avatar MangelMaxime commented on August 25, 2024

In Fulma, tabs abstraction is really simple:

    /// Generate <div class="tabs"><ul></ul></div>
    let tabs (options: Option list) children =
        let parseOptions (result : GenericOptions) option =
            match option with
            | IsCentered
            | IsRight
            | IsBoxed
            | IsToggle
            | IsToggleRounded
            | IsFullWidth -> result.AddCaseName option
            | Size size -> ofSize size |> result.AddClass
            | Props props -> result.AddProps props
            | CustomClass customClass -> result.AddClass customClass
            | Modifiers modifiers -> result.AddModifiers modifiers

        GenericOptions.Parse(options, parseOptions, "tabs").ToReactElement(div, [ ul [ ] children ])

    /// Generate <li></li>
    let tab (options: Tab.Option list) children =
        let parseOptions (result : GenericOptions) option =
            match option with
            | Tab.IsActive state -> if state then result.AddCaseName option else result
            | Tab.Props props -> result.AddProps props
            | Tab.CustomClass customClass -> result.AddClass customClass
            | Tab.Modifiers modifiers -> result.AddModifiers modifiers

        GenericOptions.Parse(options, parseOptions).ToReactElement(li, children)

The idea, is that whenever the user use Tabs.tabs we directly add the ul under the div because we know it is required.

from feliz.bulma.

MangelMaxime avatar MangelMaxime commented on August 25, 2024

The button element can also be a candidate:

    module Input =
        let internal btnInput typ options =
            let hasProps =
                options
                |> List.exists (fun opts ->
                    match opts with
                    | Props _ -> true
                    | _ -> false
                )

            if hasProps then
                let newOptions =
                    options
                    |> List.map (fun opts ->
                        match opts with
                        | Props props -> Props ((Type typ :> IHTMLProp) ::props)
                        | forward -> forward
                    )
                btnView (fun options _ -> input options) newOptions [ ]

            else
                btnView (fun options _ -> input options) ((Props [ Type typ ])::options) [ ]

        /// Generate <input type="reset" class="button" />
        let reset options = btnInput "reset" options
        /// Generate <input type="submit" class="button" />
        let submit options = btnInput "submit" options

The idea is it add the correct type directly, yep I am lazy sometimes ^^

from feliz.bulma.

MangelMaxime avatar MangelMaxime commented on August 25, 2024

In fact, you already added the button reset and submit specialization

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

I think we can mark this one as done as well, can't we?

from feliz.bulma.

MangelMaxime avatar MangelMaxime commented on August 25, 2024

There is still the tabs/tab abstraction to make I think. I didn't check the source code beforing saying that so can be wrong

from feliz.bulma.

Dzoukr avatar Dzoukr commented on August 25, 2024

Ok, I assume this one is now (thanks to Maxime) done

from feliz.bulma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.