Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement(Pagination) buttons mixin #580

Open
wants to merge 3 commits into
base: v2-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 22 additions & 42 deletions sass/components/_buttons.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
.btn, .btn-floating, .btn-large, .btn-small, .btn-flat {
:root {
--btn-height: 40px;
--btn-font-size-icon: 16px;
--btn-padding: 24px;
--btn-padding-icon: 16px;
--btn-gap-icon: 8px;
--btn-border-radius: 4px;
--btn-font-size: 14px;
}

height: var(--btn-height);
border: none;
border-radius: var(--btn-border-radius);
padding-left: var(--btn-padding);
padding-right: var(--btn-padding);
font-size: var(--btn-font-size);
font-weight: 500;
text-decoration: none;
display: inline-flex;
align-items: center;
cursor: pointer;
-webkit-tap-highlight-color: transparent; // Gets rid of tap active state
white-space: nowrap;
outline: 0;
user-select: none;
transition: background-color .2s ease-out;
.btn, .btn-floating, .btn-large, .btn-small, .btn-flat {
@include btn(
var(--btn-height),
var(--btn-border-radius),
var(--btn-padding),
var(--btn-padding),
var(--btn-font-size)
);
}

// Icon
Expand Down Expand Up @@ -54,49 +47,36 @@
//------------------ Enabled

.btn.filled {
color: var(--md-sys-color-on-primary);
background-color: var(--md-sys-color-primary);
@include btn-filled;
}

.btn.tonal {
color: var(--md-sys-color-on-secondary-container);
background-color: var(--md-sys-color-secondary-container);
@include btn-tonal;
}

.btn.elevated {
color: var(--md-sys-color-on-secondary-container);
background-color: var(--md-sys-color-secondary-container);
@extend .z-depth-1;
@include btn-elevated;
}

.btn.outlined {
background-color: transparent;
color: var(--md-sys-color-primary);
border: 1px solid var(--md-sys-color-outline);
@include btn-outlined;
}

.btn.text, .btn-flat {
@extend .z-depth-0;
color: var(--md-sys-color-primary);
background-color: transparent;
@include btn-flat;
}

//------------------ Disabled

.btn.disabled, .btn-floating.disabled, .btn-large.disabled, .btn-small.disabled, .btn-flat.disabled,
.btn:disabled, .btn-floating:disabled, .btn-large:disabled, .btn-small:disabled, .btn-flat:disabled,
.btn[disabled], .btn-floating[disabled], .btn-large[disabled], .btn-small[disabled], .btn-flat[disabled] {
@extend .z-depth-0;
color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 76%);
background-color: color-mix(in srgb, transparent, var(--md-sys-color-on-surface) 24%);
pointer-events: none;
box-shadow: none;
cursor: default;
@include btn-disabled();
}

//------------------ Hover

.btn.elevated:hover {
/*.btn.elevated:hover {
@extend .z-depth-2;
color: var(--md-sys-color-primary);
background-color: color-mix(in srgb, var(--md-sys-color-secondary-container), var(--md-sys-color-on-secondary-container) 16%);
Expand All @@ -122,11 +102,11 @@
.btn.text:hover {
color: var(--md-sys-color-primary);
background-color: color-mix(in srgb, var(--md-sys-color-primary) 16%, transparent);
}
}*/

//------------------ Focus

.btn:focus {
/*.btn:focus {
background-color: var(--md-sys-color-primary-container);
}

Expand Down Expand Up @@ -157,10 +137,10 @@
.btn:focus.text {
color: var(--md-sys-color-primary);
background-color: color-mix(in srgb, transparent, var(--md-sys-color-primary) 20%);
}
}*/

// Focus with Keyboard
.btn:focus-visible {
/*.btn:focus-visible {
&.filled,
&.elevated,
&.tonal,
Expand All @@ -169,7 +149,7 @@
outline: 3px solid var(--md-sys-color-secondary);
outline-offset: 2px;
}
}
}*/

//----------

Expand Down
19 changes: 10 additions & 9 deletions sass/components/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ textarea {
font-family: $font-stack;
}

a { color: $link-color; text-decoration: none;
a { color: $link-color; text-decoration: none;
-webkit-tap-highlight-color: transparent; // Gets rid of tap active state
}

Expand Down Expand Up @@ -117,7 +117,7 @@ i {

// Modal
html.noscroll {
position: fixed;
position: fixed;
overflow-y: scroll;
width: 100%;
}
Expand All @@ -129,8 +129,9 @@ video.responsive-video {
height: auto;
}

// moved to own component styling file @see https://github.com/materializecss/materialize/issues/566
// Pagination
.pagination {
/*.pagination {

li {
display: inline-block;
Expand Down Expand Up @@ -192,7 +193,7 @@ video.responsive-video {
white-space: nowrap;
}
}
}
}*/

// Breadcrumbs
.breadcrumb {
Expand Down Expand Up @@ -526,7 +527,7 @@ $spacing-shortcuts: ("margin": "m", "padding": "p") !default;
$spacing-directions: ("top": "t", "right": "r", "bottom": "b", "left": "l") !default;
$spacing-horizontal: "x" !default;
$spacing-vertical: "y" !default;
$spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5": 1.5rem, "6": 3rem, "auto": auto) !default;
$spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5": 1.5rem, "6": 3rem, "auto": auto) !default;

@each $property, $shortcut in $spacing-shortcuts{
@each $name, $value in $spacing-values{
Expand All @@ -537,7 +538,7 @@ $spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5
// (t, b, r, l) spacing
@each $direction, $suffix in $spacing-directions{
.#{$shortcut}#{$suffix}-#{$name}{
#{$property}-#{$direction}: $value !important
#{$property}-#{$direction}: $value !important
}
}
// x spacing
Expand All @@ -552,7 +553,7 @@ $spacing-values: ("0": 0, "1": 0.25rem, "2": 0.5rem, "3": 0.75rem, "4": 1rem, "5
.#{$shortcut}#{$spacing-vertical}-#{$name}{
#{$property}-top: $value !important;
#{$property}-bottom: $value !important;
}
}
}
}
}
}
}
45 changes: 45 additions & 0 deletions sass/components/_pagination.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Pagination
.pagination {
li {
display: inline-block;
vertical-align: top;

a {
@include btn($height: 2rem, $padding-left: .66rem, $padding-right: .66rem, $font-size: 1.2rem);
}

&.active a {
@include btn-filled;
}

&.disabled a {
@include btn-disabled;
}

i {
font-size: 2rem;
}
}

li.pages ul li {
display: inline-block;
float: none;
}
}

@media #{$medium-and-down} {
.pagination {
width: 100%;

li.prev,
li.next {
width: 10%;
}

li.pages {
width: 80%;
overflow: hidden;
white-space: nowrap;
}
}
}
Loading
Loading