davatron5000 / NodebotUI

Twitter Bootstrap for Nodebot Interfaces
MIT License
14 stars 5 forks source link

Browser Control: On/Off Toggle #6

Open dtex opened 10 years ago

dtex commented 10 years ago

Description: Can be used to turn on/off misc devices, or switch between two values. Visual representation (switch, slider, checkbox, etc) can be set with a CSS class defined in a theme. Can be updated by johnny-five to reflect physical device status.

Sample:

<input type="checkbox" data-device-type="led" data-pin="13" />

Required Attributes:

Optional Attributes:

Default Output|Input range: 0|1

Sample Uses:

rockbot commented 10 years ago

Random question: will we be including styling for these elements? i.e. I think it's fairly obvious that the toggle should look like a switch - will Nodebot(s)UI include the styling for said switch? Or will styling be left as an exercise for the user?

(Given the Bootstrap-y ness of this project, I'd think the answer is 'yes', but I just wanted to make sure :-))

dtex commented 10 years ago

Short answer, "yes".

My personal hope is it can work three ways:

  1. No CSS - For the subset of Browser Controls that depend entirely on HTML elements (i.e. checkboxes, buttons and ranges) un-styled elements will work fine. There are of course Browser Controls that won't be covered by the browser (i.e. the x/y coordinate control) that will require CSS and JS to function.
  2. Default CSS - A default CSS stylesheet that does handle all the Browser Controls. It would be bundled with NodebotUI.
  3. Inherited CSS - For that subset of browser controls that depend entirely on HTML elements there is a heck of a lot of styles out there already (jQueryUI, jQueryMobile, Bootstrap, etc). As long as we are thoughtful and don't introduce non-standard markup for these controls then those inherited styles should work fine.

Looking at @davatron5000 's comment I think another "Themeroller-like" utility that is specifically for NodebotUI is something he is interested in having which of course would be very cool.

davatron5000 commented 10 years ago

I think you've outlined a pretty good roadmap actually.

I think getting our own visual framework in there is helpful so that we can be a one stop shop forgetting robots built quickly and learners don't have to futz around with HTML n' crap.

Full steam ahead!

dtex commented 10 years ago

Oh wow, I feel dumb now. I never considered generating HTML for the user. That's a great idea of course. I was thinking of a CSS theme generator which is not nearly as helpful. I'll update the overview tonight to reflect this, but instead of versions what do you think of treating these as components that add on to core? The components could be categorized as: