Giter VIP home page Giter VIP logo

Comments (4)

roblevintennis avatar roblevintennis commented on May 29, 2024

Just to confirm, I hacked on the flexboxgrid2 demo page and got the same result by essentially doing:

.col {
/* Need these two to override /
flex: 1 1 auto;
max-width: initial;
}
.col:not(:last-child) {
margin-right: 24px; /
creates the gap between the cards */
}

image

So my thought is that we'd need to provide something like:

<FlexCol sm={12} lg={auto}>...</FlexCol>

and the cards would stack at extra small and small, but then use auto from large upward

UPDATE: After learning of the auto width section of the original upstream library (see next comment), I don't think above idea is as good as adding opt in gutters.

from agnosticui.

roblevintennis avatar roblevintennis commented on May 29, 2024

Looking some more at https://evgenyrodionov.github.io/flexboxgrid2/ I'm reminded that the library automatically gives you magic gutters (which I've removed). So, if you look at their auto section it has the gutters inside if you don't supply any sizing classes for the columns. It does this by using padding-left and padding-right on the columns, and then negate corresponding margins on the row:

image

image

So perhaps what I need to do is provide a gutters={16} which can be used as an escape hatch to opt back in to gutters for use cases like cards. Then, divide by / 2 and do padding left 8px right 8px and margin left -8px right -8px as they do.

Another benefit of this would be the consumer doesn't have to add ugly override CSS like:

.col:not(:last-child) {
  margin-right: 24px;
}

and the cards just have nice inner gutters as you'd expect.

Additionally, besides having the feature of "opt in" gutters, the consumer also gets to curate the exact size of gutters they prefer which is also a nice thing.

from agnosticui.

roblevintennis avatar roblevintennis commented on May 29, 2024

Making progress on this but after iterating I think I want to change the strategy…

Instead of
.gutter-8,
.gutter-16

and so on, I think we should do this via css custom properties:

--agnosticui-default-gutter-desktop: 0,
--agnosticui-default-gutter-tablet: 0,
--agnosticui-default-gutter-phone: 0

Essentially, by default, you haven't opted in for gutters so it simply adds these with zero values e.g. margin-left: 0 etc.

This allows consumers to override via top-level stylesheet, and thus "opt-in" by simply declaring:

--agnosticui-gutter-desktop: 24px,
--agnosticui-gutter-tablet: 16px,
--agnosticui-gutter-phone: 8px
/* or whatever makes sense to them */

from agnosticui.

roblevintennis avatar roblevintennis commented on May 29, 2024

CSS and Vue packages are refactored. Need to update svelte/react ones.

from agnosticui.

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.