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

display: contents not working as descibed #74

Open
nhugh406 opened this issue Sep 14, 2021 · 1 comment
Open

display: contents not working as descibed #74

nhugh406 opened this issue Sep 14, 2021 · 1 comment

Comments

@nhugh406
Copy link

nhugh406 commented Sep 14, 2021

``While trying to use a "custom" react component that handles grid layout, the docs state to use the display: contents attr if adding a "wrapper" around the child creates layout woes. In doing so, it still appears to mess with the layout AND does not animate.

Example:

<Grid sm={3} lg={11} gap="md">
  <XyzTransitionGroup appear xyz="fade left stagger">
    {featuredSubscriptions.map(sub => (
      <div key={sub.key} style={{ display: 'contents' }}>
        <Column lgStart={getColumnStarts(sub.subtype)} lgSpan={3}>
          <FeaturesCard
            img={getImage(sub.subtype)}
            currencyId={currencyId}
            title={featuresPricing[sub.subtype].title}
            term={sub.term}
            monthlyPrice={sub.monthlyprice}
            billingAtPrice={sub.price}
            sku={sub.value}
            features={featuresPricing[sub.subtype].features}
            btnText={btnText}
            handleCardClick={handleCardClick}
          />
        </Column>
      </div>
    ))}
  </XyzTransitionGroup>
</Grid>

This yields an 11 column grid with the first column starting in position 2. In fact, what happens is each column subsequently uses only 1 column worth of available space even when the specified span at the lg breakpoint is set to 3.

what am i missing?

@mattaningram
Copy link
Member

mattaningram commented Sep 15, 2021

Can you setup a codesandbox or something similar to help debug? Since you are using some custom React components here it is difficult to determine what exactly the issue might be. Another way to help might be to copy the generated HTML into a Codepen or sandbox.

A few questions that might help:

  • Why do you need to wrap the Column element in a div? Can you map over the Column elements and put the key directly on them?
  • Can you avoid using the custom layout elements and just use className and regular CSS? That way you might be able to avoid needing wrapping elements and the grid styles can go directly on the element generated by the XyzTransitionGroup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants