Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Buttonify #282

Merged
merged 16 commits into from
Mar 2, 2017
Merged

Buttonify #282

merged 16 commits into from
Mar 2, 2017

Conversation

yoshuawuyts
Copy link
Contributor

@yoshuawuyts yoshuawuyts commented Feb 27, 2017

This implements part of #280,
namely buttons and icons. It creates a slightly more intuitive API to create
elements, and decouples the icons from the buttons itself making them more
flexible. All elements should be accessible and reusable between projects.

The app runs and all event seem to work as expected which means I caught all
instances I think. Thanks!

API

var button = require('./elements/button')
var icon = require('./elements/icon')

icon('exit')                    // render an exit icon
icon('exit', { class: 'pt3' })  // render an exit icon with extra classes

button('some-button')                                      // render a plain button
button.green('my-cool-button', { onclick: handleclick })   // render a green button with an onclick handler
button.icon('my-cooler-button', { icon: icon('exit') })    // render an accessible icon-only button
button('some-button', { class: 'pr2 mt3' })                // render a plain button with extra classes

@yoshuawuyts yoshuawuyts added this to the 2017-03-07 milestone Feb 27, 2017
@yoshuawuyts yoshuawuyts self-assigned this Feb 27, 2017
@yoshuawuyts
Copy link
Contributor Author

hah, found some beautiful glitches - hold on with the merge for a lil bit ok?

return html`
<label for="dat-import" class="relative dib pa0 b--none ${prefix}">
<input name="dat-import"
type="text"
placeholder="Import dat"
onkeydown=${onKeyDown}
class="input-reset">
${linkIcon}
${icon('link', { class: 'absolute top-0 bottom-0 left-0' })}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this syntax?

icon('#link.absolute.top-0.bottom-0.left-0')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I kinda like that; very close to hyperscript's class / id shorthand - I think having that at some point would definitely make sense. Nice ✨

I'd probably make sure there'd be full consistency with hyperscript tho:

icon('link.absolute.top-0.bottom-0.left-0#some-id')

but yeah that's nit picking. I like it!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having the 'class' dict, it also is just as simple and already works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah nah, agree - this would only work for icons right now; buttons is harder - gonna leave this for a bit

@yoshuawuyts
Copy link
Contributor Author

@Kriesse ran into an SVG styling issue; not sure what changed but could you perhaps take a look - styling SVGs has never been my forte. Once that's fixed this should be ready to merge.

screen shot 2017-03-02 at 10 19 23

@Kriesse
Copy link
Collaborator

Kriesse commented Mar 2, 2017

@yoshuawuyts the intro screen and a few other small misalignments are fixed, ready to merge from my side! Preview:
image

@yoshuawuyts
Copy link
Contributor Author

Awesome, just ran through it and it's looking 💯 - merging!

@yoshuawuyts yoshuawuyts merged commit 8106adf into master Mar 2, 2017
@yoshuawuyts yoshuawuyts deleted the buttonify branch March 2, 2017 14:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants