-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(col): modernizing Grid component #30658
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
base: next
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
core/src/components/col/col.scss
Outdated
/** | ||
* @prop --col-unit-size: The size of each Column unit. | ||
*/ | ||
--col-unit-size: calc((100% - (var(--ion-grid-columns, 12) - 1) * var(--ion-grid-gap)) / var(--ion-grid-columns, 12)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to instead of 12, add a --grid-type variable here, that by default would be 12?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what where would --grid-type
variable come from?
I can also simply delete the the constant 12
, as the variable --ion-grid-columns
will be initialized with 12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was suggesting something like that, just create a variable to leave it open for the future, with default value set to 12. If anyone wants they can change that variable to also change the grid columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, this is an existing ionic variable --ion-grid-columns
. We are just using it. The default 12, was removed from the implementation. Thank you for the feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment on the Jira ticket with more info. 🙂
<h4 id="version-9x-grid">Grid</h4> | ||
- The properties `pull` and `push`, have been removed. The similar look can be achieved with the newly added property `order`. | ||
|
||
<h5>Example 1: Swap two columns</h5> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an example for migrating this:
<ion-grid>
<ion-row>
<ion-col size="auto" push="1">
<div>ion-col push 1</div>
</ion-col>
<ion-col size="auto" push="1">
<div>ion-col push 1</div>
</ion-col>
</ion-row>
</ion-grid>
<ion-col size="3" order="1">2</ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an example for migrating size & push/pull with breakpoints:
<ion-grid>
<ion-row>
<ion-col size="3" size-md="6" push="9" push-md="6">
<div>ion-col size="3" size-md="6" push="9" push-md="6"</div>
</ion-col>
<ion-col size="9" size-md="6" pull="3" pull-md="6">
<div>ion-col size="9" size-md="6" pull="3" pull-md="6"</div>
</ion-col>
</ion-row>
</ion-grid>
Co-authored-by: Brandy Smith <[email protected]>
What is the current behavior?
The existing grid component (
ion-grid
,ion-row
, andion-col
) in Ionic was developed several years ago and has not received significant updates since then. As a result, it does not leverage modern CSS features. For example, the gutter (spacing) between columns is implemented using the border property, which is an outdated technique.What is the new behavior?
--ion-grid-gap
: this new CSS variable, will indicate the gap size in the grid. Defaults to0px
- the current value.ion-col
: has a new way to calculate the width of the column. Additionally a new propertyorder
(and responsive variants) was added, and will control the order of the column.ion-row
: uses the newly introduced custom property--ion-grid-gap
. This property will indicate the gap size in the grid.Does this introduce a breaking change?
The properties
pull
andpush
fromion-col
, have been removed. The functionality achieved with them, is now achieved with the new propertyorder
and the existingsize
. More information and migration examples can be read inBREAKING.md
file.Other information