Skip to content

Commit 36306b7

Browse files
committed
Try making Button sizing with padding instead of height
1 parent a7f6202 commit 36306b7

8 files changed

Lines changed: 27 additions & 11 deletions

File tree

app-compat/pages/buttons.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<Button text="btn btn-primary btn-ruby" class="btn btn-primary btn-ruby"/>
1414
<Button class="btn btn-primary">
1515
<FormattedString>
16-
<Span text="{{ 'fa-twitter' | fonticon }}" class="fa nt-icon"/>
16+
<Span text="{{ 'fa-twitter' | fonticon }}" class="fa"/>
1717
<Span text=" btn btn-primary with icon"/>
1818
</FormattedString>
1919
</Button>

app/app-vars.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@
77
.test-variable {
88
background: var(--color-grey-light);
99
}
10+
11+
.ns-root Button {
12+
//font-size: 42;
13+
}
14+

app/pages/buttons.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Button text="Button.-primary.-ruby" class="-primary -ruby"/>
1313
<Button class="-primary">
1414
<FormattedString>
15-
<Span text="{{ 'fa-twitter' | fonticon }}" class="fa nt-icon"/>
15+
<Span text="{{ 'fa-twitter' | fonticon }}" class="fa"/>
1616
<Span text=" Button.-primary with icon"/>
1717
</FormattedString>
1818
</Button>

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const rootModalTrap = {
126126
app.on(app.displayedEvent, () => {
127127
const root = app.getRootView();
128128

129-
// Bail out if no root view or root classes already set (pre 6.1).
129+
// Bail out if no root view or root classes already set (since 6.1).
130130
if (!root || root.cssClasses.has("ns-root")) {
131131
// Add ns-{platform}-{sdkVersion} classes
132132
if (root) {

src/scss/mixins/_buttons.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
}
66

77
@mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
8-
padding: $padding-y $padding-x $padding-y $padding-x;
8+
padding-top: $padding-y;
9+
padding-left: $padding-x;
10+
padding-bottom: $padding-y;
11+
padding-right: $padding-x;
912
font-size: $font-size;
1013

1114
@include border-radius($border-radius);
1215
}
1316

1417
@mixin button-base($padding-y, $padding-x, $margin-y, $margin-x, $font-size, $border-radius, $min-width, $height) {
1518
min-width: $min-width;
16-
height: $height;
1719

1820
@include button-size($padding-y, $padding-x, $font-size, $border-radius);
1921
@include button-margin($margin-y, $margin-x);

src/scss/mixins/components/_button.scss

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,53 @@
44
#{$selectors} {
55
text-transform: none;
66
border-color: transparent;
7+
min-height: 36;
8+
min-width: 100;
79

810
@include button-base(const(btn-padding-y), const(btn-padding-x), const(btn-margin-y), const(btn-margin-x), const(btn-font-size), const(btn-radius), const(btn-min-width), const(btn-height));
911

1012
.ns-ios & {
11-
height: const(btn-height) - 12;
1213
border-width: 0;
1314
}
1415

1516
.ns-android & {
17+
padding-top: const(btn-padding-y) + 3;
18+
padding-bottom: const(btn-padding-y) + 3;
19+
1620
margin: const(btn-margin-y) - 4 const(btn-margin-x) - 4;
1721
}
1822

1923
@if $enable-rounded {
20-
height: const(btn-height) - 12;
2124
border-width: const(border-width);
2225
border-color: transparent;
2326

2427
.ns-android & {
28+
padding-top: const(btn-padding-y) - 3;
29+
padding-bottom: const(btn-padding-y) - 3;
30+
2531
margin: const(btn-margin-y) const(btn-margin-x);
2632
}
2733
}
2834

2935
#{if($compat, '&-outline', '&.-outline')} {
30-
height: const(btn-height) - 12;
3136
border-width: const(border-width);
3237

3338
.ns-android & {
39+
padding-top: const(btn-padding-y) - 3;
40+
padding-bottom: const(btn-padding-y) - 3;
41+
3442
margin: const(btn-margin-y) const(btn-margin-x);
3543
}
3644
}
3745

3846
#{if($compat, '&-rounded-sm', '&.-rounded-sm')},
3947
#{if($compat, '&-rounded-lg', '&.-rounded-lg')} {
40-
height: const(btn-height) - 12;
4148
border-radius: const(border-radius-sm);
4249

4350
.ns-android & {
51+
padding-top: const(btn-padding-y) - 3;
52+
padding-bottom: const(btn-padding-y) - 3;
53+
4454
margin: const(btn-margin-y) const(btn-margin-x);
4555
}
4656
}

src/scss/mixins/components/_forms.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
horizontal-align: center;
4343

4444
Button {
45-
width: 50%;
4645
margin: 5;
4746
}
4847
}

src/scss/variables/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $btn-font-size: $font-size + 2 !default;
2323
$btn-min-width: 64 !default;
2424
$btn-height: 52 !default;
2525
$btn-padding-x: 5 !default;
26-
$btn-padding-y: 0 !default;
26+
$btn-padding-y: 10 !default;
2727
$btn-margin-x: 16 !default;
2828
$btn-margin-y: 8 !default;
2929
$btn-radius: 0 !default;

0 commit comments

Comments
 (0)