Coder Social home page Coder Social logo

tmonte / fabulosa Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 7.47 MB

Spectre CSS Components for Fable

Home Page: https://fabulosa-ui.github.io/fabulosa

F# 60.26% JavaScript 2.06% Batchfile 0.01% Shell 0.17% CSS 37.49%
fsharp fable spectre-css ui

fabulosa's People

Stargazers

 avatar

Watchers

 avatar

Forkers

gitter-badger

fabulosa's Issues

Forms

  • Inline Forms
  • Form Sizes
  • Input Groups
  • Validation States

Component API decisions

With props and html props

1) Record with options

Button.button {
    props = Some [Button.Size Button.Small]
    htmlProps = Some [OnClick (fun e -> e |> console.log)]
    children = None
}
  • Implementation: easy
  • CC: 140
  • Default CC (no props, no html props, no children): 75
  • Parameter clarity: high

2) Record with defaults

Button.button { Button.default with
    props = [Button.Size Button.Small]
    htmlProps = [OnClick (fun e -> e |> console.log)]
}
  • Implementation: easy
  • CC: 130
  • Default CC (no props, no html props, no children): 28
  • Parameter clarity: high

3) Record with default passed to render

{ Button.button with
    props = [Button.Size Button.Small];
    htmlProps = [OnClick (fun e -> e |> console.log)] }
    |> Button.render
  • Implementation: easy
  • CC: 137
  • Default CC (no props, no html props, no children): 30
  • Parameter clarity: high

4) Transforms for button props, keeping react signature

Button.button [OnClick (fun e -> e |> console.log)]
    |> transform
    Button.propToClass
    [Button.Size Button.Small]
  • Implementation: medium
  • CC: 122
  • Default CC (no props, no html props, no children): 16
  • Parameter clarity: low

5) Button with props, htmlProps and children as lists and default version

Button.create
    [Button.Kind Button.Default]
    [OnClick (fun e -> e |> console.log)]

Button.button "text"
  • Implementation: very easy
  • CC: 88
  • Default CC (no props, no html props, no children): 13
  • Parameter clarity: low

Specifying Props

6) Record with props including html props needed

{ Button.button with
    size = Button.Small;
    onClick = (fun e -> e |> console.log) }
    |> Button.render
  • Implementation: medium-hard
  • CC: 110
  • Default CC (no props, no html props, no children): 30
  • Parameter clarity: very high

7) Record with props without default and including html props needed

Button.button { Button.default with
    size = Button.Small;
    onClick = (fun e -> e |> console.log) }
  • Implementation: medium-hard
  • CC: 104
  • Default CC (no props, no html props, no children): 28
  • Parameter clarity: very high

Chosen implementation:

Mix of 2 and 6

Button.button {
    Button.defaults with
        Kind = Button.Default
        HTMLProps = [OnClick (fun e -> e |> console.log)] } []

Bars

Bars

Bars represent the progress of a task or the value within the known range. Bars are custom components for displaying HTML5 , and input range elements.

Add a container element with the bar class. And add child elements with the bar-item class. The width percentage value is needed for every bar-item.

There is the bar-sm class for thinner Bars. Also, you could use Tooltips for any bar-item.

<!-- normal bars -->
<div class="bar bar-sm">
  <div class="bar-item" role="progressbar" style="width:25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<!-- multi-bars -->
<div class="bar">
  <div class="bar-item tooltip" data-tooltip="25%" style="width:25%;">25%</div>
  <div class="bar-item" style="width:15%;background:#818bd5;">15%</div>
</div>

Slider bars

You can add the bar-slider class to the Bars container. And add child elements with the bar-item class and bar-slider-btn inside bar-item. You need to set the bar-item width manually to have the slider point.

If there are two bar-item divs in one bar-slider, you will have a range slider.

<!-- normal slider -->
<div class="bar bar-slider">
  <div class="bar-item" role="progressbar" style="width:25%;">
    <button class="bar-slider-btn btn" role="slider"></button>
  </div>
</div>
<!-- range slider -->
<div class="bar bar-slider">
  <div class="bar-item" role="progressbar" style="width:15%;">
    <button class="bar-slider-btn btn" role="slider"></button>
  </div>
  <div class="bar-item" role="progressbar" style="width:65%;">
    <button class="bar-slider-btn btn" role="slider"></button>
  </div>
</div>

Refactor components

Refactor components to use

  • Typed children
  • Props & Children as tuples
  • Sub modules
  • Bar (needs push)
  • Card (needs push)
  • Chip
  • Empty
  • Menu
  • Nav
  • Table
  • Tag
  • Breadcrumb
  • Code
  • Media
  • Badge (change props to children)

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.