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

feat: add more flex layout support #19

Merged
merged 12 commits into from
Feb 24, 2023
Prev Previous commit
Next Next commit
add static hide selector without media query
  • Loading branch information
philmtd committed Feb 24, 2023
commit 02a3f1e613732f886f72583920bedd8d53aa2c83
1 change: 1 addition & 0 deletions documentation/docs/attribute-selectors/show-hide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The attributes have the following naming scheme:

* `data-show-[mediaQueryName]`
* `data-hide-[mediaQueryName]`
* `data-hide`

With `mediaQueryName` being the name of one of the [available media queries](../responsive#media-queries).

Expand Down
3 changes: 1 addition & 2 deletions documentation/docs/flex-layout-migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ Let's start with what is missing in css-fx-layout in comparison with Angular Fle
* no alternative for `fxFlexOrder`
* no alternative for `fxFlexOffset`
* no custom breakpoints
* the alternatives to `fxShow`/`fxHide` only support the responsive API
* the alternative to `fxShow` does not work the same way it does in Flex-Layout
* the alternative to `fxShow` only supports the responsive API and does not work the same way it does in Flex-Layout

:::warning Migrate away from `fxShow` / `data-show`

Expand Down
3 changes: 3 additions & 0 deletions src/lib/show-hide-attributes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

/// Generates show/hide attribute selectors
@mixin show-hide-attributes {
*[data-hide] {
display: none !important;
}
@each $breakpoint, $_ in $flex-layout-media-queries {
*[data-show-#{$breakpoint}] {
@include flex-layout-media-not($breakpoint) {
Expand Down
3 changes: 3 additions & 0 deletions src/lib/show-hide-classes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

/// Generates show/hide class selectors
@mixin show-hide-classes {
*.hide {
display: none !important;
}
@each $breakpoint, $_ in $flex-layout-media-queries {
*.show-#{$breakpoint} {
@include flex-layout-media-not($breakpoint) {
Expand Down
6 changes: 6 additions & 0 deletions test/show-hide.spec.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
@include shc.show-hide-classes;
}
@include true.expect {
*.hide {
display: none !important;
}
@include mix.xs(true) {
*.show-xs {
display: none !important;
Expand Down Expand Up @@ -150,6 +153,9 @@
@include sha.show-hide-attributes;
}
@include true.expect {
*[data-hide] {
display: none !important;
}
@include mix.xs(true) {
*[data-show-xs] {
display: none !important;
Expand Down