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

how to get current column count #94

Closed
peyman-hakemi opened this issue Jun 23, 2023 · 2 comments
Closed

how to get current column count #94

peyman-hakemi opened this issue Jun 23, 2023 · 2 comments
Labels
question Further information is requested

Comments

@peyman-hakemi
Copy link

peyman-hakemi commented Jun 23, 2023

Description

I am using the MasonryGrid component in React, and I want to change the alignment from "justify" to "center" when the column count is set to 1. Currently, when I resize the screen and there are two columns, the items are aligned apart from each other. However, when the screen is resized to have one column, the items are aligned to the left instead of being centered. How can I achieve center alignment in this scenario?

  <MasonryGrid
      className="container"
      gap={60}
      defaultDirection={"start"}
      align={"justify"} // want this to be center when column count was 1
      column={0}
      columnSize={0}
      columnSizeRatio={0}
      onRenderComplete={(e) => {
        console.log(e);
      }}
    >
      <ProjectCard
      />
      <ProjectCard
      />
      <ProjectCard
      />
      <ProjectCard
      />
      <ProjectCard
      />
      <ProjectCard
      />
    </MasonryGrid>
@daybrush daybrush added the question Further information is requested label Jun 26, 2023
@daybrush
Copy link
Member

@peyman-hakemi

Calling the .getComputedOutlineLength() method will return the column of items currently being rendered.

@malangfox
Copy link
Contributor

Since there is no further comment, we will close the issue.

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

No branches or pull requests

3 participants