Skip to content

shared functions and types for Bolero, supporting CSS ๐Ÿ’„, specifically Bulma CSS ๐Ÿฑ๐Ÿ–ผ

License

Notifications You must be signed in to change notification settings

BryanWilhite/Songhay.Modules.Bolero

Repository files navigation

Songhay.Modules.Bolero

shared functions and types for Bolero, supporting CSS ๐Ÿ’„, specifically Bulma CSS ๐Ÿฑ๐Ÿ–ผ

NuGet package ๐Ÿ“ฆ: Songhay.Modules.Bolero

These are the main concerns of this work:

  • Utility, mostly sharing functions for Remoting and IJSRuntime
  • Visuals, a deliberately incomplete coverage of HTML, CSS and Bulma by Jeremy Thomas
  • Models (Primitives), Fโ™ฏ primitive obsession, supporting the Visuals

Utility

There are four utilities:

  1. a utility for Bolero [src]
  2. a utility for JSON documents [src]
  3. a utility for IJSRuntime [src]
  4. a utility for IRemoteService [src]

Visuals and Models

Here is my first attempt at building a DSL for HTML, CSS and Bulma CSS on top of Bolero. For example, here is an expression [GitHub], rendering Bulma tabs, overriding the Bolero ElmishComponent<_,_>:

override this.View model dispatch =
    concat {

        let tabPairs =
            [
                ( text "README", ReadMePage )
                ( concat { text "Bolero "; code { text "IJsRuntime" } }, BoleroJsRuntimePage )
                ( text "Bulma Visuals", BulmaVisualsPage )
            ]
            |> List.map (fun (n, page) ->
                    anchorElement NoCssClasses (HasAttr <| ElmishRoutes.router.HRef page) n, page
            )

        bulmaTabs
            (HasClasses <| CssClasses [
                ColorEmpty.BackgroundCssClassLight
                CssClass.tabsElementIsToggle
                CssClass.elementIsFullWidth
                SizeLarge.CssClass
            ])
            (fun page -> model.page = page)
            tabPairs

        cond model.page <| function
        | ReadMePage -> ReadMeElmishComponent.EComp model dispatch
        | BoleroJsRuntimePage -> BoleroJsRuntimeElmishComponent.EComp model dispatch
        | BulmaVisualsPage -> BulmaVisualsElmishComponent.EComp model dispatch
    }

The preference here (at the moment) is to have more types than functions for the DSL. These types are grouped into four models of primitives:

  1. Bulma Primitives [src]
  2. CSS Primitives [src]
  3. HTML Primitives [src]
  4. SVG Primitives [src]

These models support the functions of the Visuals:

  1. HTML Body Visuals [src]
  2. CSS Declarations [src]
  3. HTML Head Elements [src]
  4. Bulma Component Visuals [src]
  5. Bulma CSS Class names [src]
  6. Bulma Element Visuals [src]
  7. Bulma Form Element Visuals [src]
  8. Bulma Layout Visuals [src]

The coverage of HTML is quite limited because Bulma itself has its own, excellent HTML DSL on which this work depends heavily. The generic CSS coverage is starting off with typography. The Bulma-specific coverage is the most extensive but lacking in the following areas:

I look forward to working a bit more on this Bulma coverage, likely starting with Bulma pagination.

custom JavaScript is needed for the Bulma Navbar

In order to toggle the Bulma Navbar burger and its dropdown menu, the following JavaScript is needed:

(() => {

    window.addEventListener('DOMContentLoaded', () => {
        const burger = document.querySelector('.navbar-burger');
        const nav = document.querySelector(`#${burger.dataset.target}`);
        const isActiveCssClass = 'is-active';

        burger.addEventListener('click', () => {
            burger.classList.toggle(isActiveCssClass);
            nav.classList.toggle(isActiveCssClass);
        });
    });

})();

This JavaScript is similar to the code provided in the Bulma documentation.

the โ€˜studio floorโ€™ for this Solution

`Songhay.Modules.Bolero` release 6.4.0

`Songhay.Modules.Bolero` release 6.4.0

The Songhay.StudioFloor.Client project [GitHub] has at least two purposes:

  1. demonstrate how the Bulma components and elements look and operate
  2. provide a โ€œreferenceโ€ SCSS and Typescript npm pipeline

๐Ÿ™๐ŸˆBryanWilhite

About

shared functions and types for Bolero, supporting CSS ๐Ÿ’„, specifically Bulma CSS ๐Ÿฑ๐Ÿ–ผ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published