Giter Club home page Giter Club logo

Comments (13)

lechup avatar lechup commented on August 29, 2024 4

@leejordan I've created a gist to show what i mean:
https://gist.github.com/lechup/269fd0e93e82d205266d636981ddceb0

It is based on Twitter bootrstrap 4 approach:
http://v4-alpha.getbootstrap.com/layout/responsive-utilities/#available-classes

from reflex.

leejordan avatar leejordan commented on August 29, 2024 3

I guess I'm just concerned it will bloat out the framework for a feature that not everybody will need. Right now it's quite focused on one thing. However, it's possible I am wrong about this :)

from reflex.

leejordan avatar leejordan commented on August 29, 2024 2

I guess that's worth it as it seems like there is some demand. Open a PR and I'll replicate the same functionality in LESS just for parity 👍

from reflex.

leejordan avatar leejordan commented on August 29, 2024 1

I ended up needing these myself so I've added my implementation which is optional in version 1.5.0

https://github.com/leejordan/reflex/releases/tag/1.5.0

from reflex.

dmoojunk avatar dmoojunk commented on August 29, 2024

For anyone interested, I quite liked this scss pattern for generating this - Credit to csswizardry and inuitt.css for the patterns. I will try and get round to a PR.

$breakpoints: (
    'xs-only'     'screen and (max-width: 29.94em)',
    'sm-only'     'screen and (min-width: 30em) and (max-width: 47.94em)',
    'sm-and-up'   'screen and (min-width: 30em)',
    'md-only'     'screen and (min-width: 48em) and (max-width: 74.94em)',
    'md-and-up'   'screen and (min-width: 48em)',
    'lg-only'     'screen and (min-width: 75em) and (max-width: 99.94em)',
    'lg-and-up'   'screen and (min-width: 75em)',
    'xlg-and-up'  'screen and (min-width: 100em)',

    'palm'               'screen and (max-width: 47.94em)',
    'lap'                'screen and (min-width: 48em) and (max-width: 74.94em)',
    'lap-and-up'         'screen and (min-width: 48em)',
    'portable'           'screen and (max-width: 74.94em)',
    'desk'               'screen and (min-width: 75em)',

    'retina'      '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)'
  ) !default;
@mixin media-query($mq) {
  $breakpoint-found: false;
  // Loop through the list of breakpoints we’ve provided in our settings file.

  @each $breakpoint in $breakpoints {
    // Grab the alias and the condition from their respective locations in
    // the list.
    $alias: nth($breakpoint, 1);
    $condition: nth($breakpoint, 2);
    // If the media query we’ve specified has an alias and a condition...

    @if $mq == $alias and $condition {
      // ...tell the mixin that we’ve found it...
      $breakpoint-found: true;
      // ...and spit it out here.

      @media #{$condition} {

        @content;
      }
    }
  }
  // If the user specifies a non-exitent alias, send them a warning.

  @if $breakpoint-found == false {

    @warn  'Oops! Breakpoint ‘#{$mq}’ does not exist. ';
  }
}
@mixin hide {
  display: none !important;
}
@each $state in xs-only,
  sm-only,
  sm-and-up,
  md-only,
  md-and-up,
  lg-only,
  lg-and-up,
  xlg-and-up,
  palm,
  lap,
  lap-and-up,
  portable,
  desk,
  retina {

  @include media-query(#{$state}) {
    .hide--#{$state} {
      @include hide;
    }
  }
}

from reflex.

dmoojunk avatar dmoojunk commented on August 29, 2024

@leejordan fair enough. Its not difficult to implement if you need it.

from reflex.

lechup avatar lechup commented on August 29, 2024

Hm... @leejordan so maybe we create separate repo reflex-grid-addons and provide info in the docs ?

from reflex.

leejordan avatar leejordan commented on August 29, 2024

Maybe we could add it to this repo but I'm open to ideas on how to make it optional in here. Or maybe I'm just wrong and it should be added by default. I'd be interested to see how much it adds to the final compiled and minified css file size.

from reflex.

lechup avatar lechup commented on August 29, 2024

See here:
https://gist.github.com/lechup/8bcf7b7af87e0d881c23a4674c75d540#file-reflexvisibility-min-css
it is 646 bytes

10195 bytes has reflexgrid itself, so it is 6,4% size gain ...

from reflex.

lechup avatar lechup commented on August 29, 2024

@leejordan I was checking the size of my gist. @dmoojunk code has additional classes visible-only.

Which one do You want me to include? TWB4 classes up/down or code proposed by @dmoojunk ?

from reflex.

dmoojunk avatar dmoojunk commented on August 29, 2024

I would strip the visible only's. Its a pretty niche use case I have.

from reflex.

kode8 avatar kode8 commented on August 29, 2024

This would be super handy! Foundation do the same, hide-for-medium, show-for-medium-up etc

from reflex.

manuelbieh avatar manuelbieh commented on August 29, 2024

Nice. I landed here because I wanted to open a ticket for that. I need to hide content on small devices. That's currently not possible. Which is bad. In my case. I'm pretty sure there will be other people looking for a way to hide content on mobile.

Adding something like

.grid__col-xs-hidden, 
.grid__col-sm-hidden, 
.grid__col-md-hidden, 
.grid__col-lg-hidden, 
.grid__col-xlg-hidden {
  display: none;
}

doesnt bloat anything.

from reflex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.