-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: split button implementation (#1448)
* #925 split button implementation
- Loading branch information
Saad M
committed
May 28, 2019
1 parent
1567d0f
commit a0d61b8
Showing
29 changed files
with
292 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@import "./../settings"; | ||
@import "./../mixins"; | ||
@import "./../functions"; | ||
|
||
/*! | ||
.fd-button-split+() | ||
.fd-button | ||
*/ | ||
$block: #{$fd-namespace}-button-split; | ||
|
||
.#{$block} { | ||
|
||
@include fd-reset-spacing(); | ||
display: inline-flex; | ||
vertical-align: middle; | ||
position: relative; | ||
// & > * { | ||
margin: 0; | ||
[class*="fd-button"]:first-child { | ||
border-top-right-radius: 0; | ||
border-bottom-right-radius: 0; | ||
} | ||
[class*="fd-button"]:nth-child(2) { | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
border-left-width: 0; | ||
} | ||
@include fd-rtl() { | ||
[class*="fd-button"]:nth-child(2) { | ||
border-top-left-radius: $fd-border-radius; | ||
border-bottom-left-radius: $fd-border-radius; | ||
border-top-right-radius: 0; | ||
border-bottom-right-radius: 0; | ||
border-left-width: 1px; | ||
} | ||
[class*="fd-button"]:first-child { | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
border-top-right-radius: $fd-border-radius; | ||
border-bottom-right-radius: $fd-border-radius; | ||
border-left-width: 0; | ||
} | ||
} | ||
// } | ||
.fd-button--emphasized { | ||
&:first-child { | ||
margin-right: 1px; | ||
} | ||
@include fd-rtl() { | ||
&:first-child { | ||
margin-right: 0; | ||
margin-left: 1px; | ||
} | ||
} | ||
} | ||
.fd-popover__body { | ||
width: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% from "../button/component.njk" import button %} | ||
<!-- | ||
button_split: | ||
properties={}, | ||
modifier={ block: [] }, | ||
state={}, | ||
aria={} | ||
--> | ||
{% macro button_split(properties={}, modifier={}, state={}, aria={}) -%} | ||
<div class="fd-button-split{{ modifier.block | modifier('button-split') }}{{ state | state }}"{{ aria | aria }} role="group" aria-label="{{properties.label}}"> | ||
{{- caller() | indent -}} | ||
</div> | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"id": "button-split", | ||
"name": "Button Split", | ||
"css_vars": true, | ||
"rtl": true, | ||
"version": "1.0.0", | ||
"properties": { | ||
"label": "Group label", | ||
"buttons": [ | ||
{ | ||
"properties": { | ||
"label": "Left" | ||
}, | ||
"aria": { | ||
"pressed": true | ||
} | ||
}, | ||
{ | ||
"properties": { | ||
"label": "Middle" | ||
} | ||
}, | ||
{ | ||
"properties": { | ||
"label": "Right" | ||
} | ||
} | ||
] | ||
}, | ||
"modifier": {}, | ||
"state": {}, | ||
"aria": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{% extends "layout.njk" %} | ||
{% from "./../format.njk" import format %} | ||
{% from "./component.njk" import button_split %} | ||
{% from "../button/component.njk" import button %} | ||
{% from "../menu/component.njk" import menu %} | ||
{% from "./../popover/component.njk" import popover_body %} | ||
{% import "./../utils.njk" as utils %} | ||
|
||
|
||
<!-- include add'tl css from src/styles/, e.g., ['helpers','components/button'] --> | ||
{% set css_deps = ['components/button','icons' ,'components/menu', 'components/popover'] %} | ||
|
||
{% block content %} | ||
|
||
<h2>default</h2> | ||
|
||
{% set emphasis = ["emphasized", ""] %} | ||
{% set size = ["", "compact"] %} | ||
{% set types = ["", "standard", "positive ", "medium", "negative" ] %} | ||
|
||
{% for s in size %} | ||
|
||
<br><br> | ||
<h2> {{s}}</h2> | ||
|
||
{% set example %} | ||
|
||
{% for e in emphasis %} | ||
{% for t in types %} | ||
{% call button_split() -%} | ||
{{- button( | ||
{ | ||
icon: 'cart', | ||
label: 'Button' | ||
}, | ||
modifier={ block: [s, e, t] }, | ||
aria={ label: 'button' }) | ||
}} | ||
{{- button( | ||
{ | ||
icon: 'slim-arrow-down' | ||
}, | ||
modifier={ block: [s, e, t] }, | ||
aria={ label: 'dropdown'}) | ||
}} | ||
{%- endcall %} | ||
{% endfor %} | ||
<br><br> | ||
{% endfor %} | ||
{% endset %} | ||
{{ format(example) }} | ||
|
||
{% endfor %} | ||
|
||
<br><br> | ||
|
||
<h2>with popover menu</h2> | ||
{% set example %} | ||
{%- set _id = utils.id() %} | ||
{% call button_split() -%} | ||
{{- button( | ||
{ | ||
icon: 'cart', | ||
label: 'Button with text' | ||
}, | ||
modifier={ block: ['emphasized'] }, | ||
aria={ label: 'button' }) | ||
}} | ||
{{- button({ icon: 'slim-arrow-down' }, modifier={ block: ['emphasized'] }, aria={ controls: _id, haspopup: true, expanded: false, label: 'More' }) | indent(4) }} | ||
{{ popover_body(properties={ | ||
id: _id, | ||
body: menu(properties={ | ||
items: [ | ||
{ "label": "Add to list" }, | ||
{ "label": "Save for later" } | ||
] | ||
}) | ||
}, | ||
modifier={ block: ['no-arrow', 'right']}, | ||
classes="contextual-menu" | ||
) | indent(4) | ||
}} | ||
|
||
{%- endcall %} | ||
|
||
{% endset %} | ||
{{ format(example) }} | ||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.51 KB
...ssion_fundamental_button-split_0_example-containerfd-button-split_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.47 KB
...fundamental_button-split_10_example-containerfd-button-split__n10_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.5 KB
...fundamental_button-split_11_example-containerfd-button-split__n11_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.5 KB
...fundamental_button-split_12_example-containerfd-button-split__n12_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.43 KB
...fundamental_button-split_13_example-containerfd-button-split__n13_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.42 KB
...fundamental_button-split_14_example-containerfd-button-split__n14_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
...fundamental_button-split_15_example-containerfd-button-split__n15_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.5 KB
...fundamental_button-split_16_example-containerfd-button-split__n16_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.49 KB
...fundamental_button-split_17_example-containerfd-button-split__n17_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.41 KB
...fundamental_button-split_18_example-containerfd-button-split__n18_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.44 KB
...fundamental_button-split_19_example-containerfd-button-split__n19_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.55 KB
...n_fundamental_button-split_1_example-containerfd-button-split__n1_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.27 KB
...fundamental_button-split_20_example-containerfd-button-split__n20_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.54 KB
...n_fundamental_button-split_2_example-containerfd-button-split__n2_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.47 KB
...n_fundamental_button-split_3_example-containerfd-button-split__n3_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.46 KB
...n_fundamental_button-split_4_example-containerfd-button-split__n4_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.49 KB
...n_fundamental_button-split_5_example-containerfd-button-split__n5_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.54 KB
...n_fundamental_button-split_6_example-containerfd-button-split__n6_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.53 KB
...n_fundamental_button-split_7_example-containerfd-button-split__n7_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
...n_fundamental_button-split_8_example-containerfd-button-split__n8_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.48 KB
...n_fundamental_button-split_9_example-containerfd-button-split__n9_0_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.