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

Use grid layout with grid-areas for card component #21

Open
ricominten opened this issue Jun 21, 2019 · 3 comments
Open

Use grid layout with grid-areas for card component #21

ricominten opened this issue Jun 21, 2019 · 3 comments

Comments

@ricominten
Copy link
Collaborator

Can we use grid layout with grid-areas to determine the layout for the card component.

Benefits:
Setting elements of the card (title/image/text/etc.) to a grid-area makes the card much more flexible in its use. Designers are now able to change the layout without it breaking the core component. All the developer has to do is re-assign the grid to update the design.

@ricominten ricominten changed the title Use grid layout with grid-areas for card element Use grid layout with grid-areas for card component Jun 21, 2019
@jennasalau
Copy link
Contributor

Hey @ricominten can you provide an example here just so we are clear on what you are suggesting. Sounds promising.

@ricominten
Copy link
Collaborator Author

ricominten commented Jun 24, 2019

Similar to the RUI-Layout we can have 1 defined HTML markup with different visual representations. As the card element will have limited content and elements it should not affect A11Y.

To create the below layout the following CSS is required:

1

.container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: 
      "image"
      "title"
      "subtitle"
      "content"
      "actions";
}

2

.container {
    display: grid;
    grid-template-columns: 20px 1fr;
    grid-template-rows: auto;
    grid-template-areas: 
      "icon title"
      "icon subtitle"
      "image image"
      "content content"
      "actions actions";
}

3

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    grid-template-areas: 
      "title image"
      "subtitle image"
      "content image"
      "actions image";
}

@ricominten
Copy link
Collaborator Author

For an example see here:
https://codepen.io/ricominten/pen/pXPGrj

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