-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
67329a7
to
ae870b9
Compare
Codecov Report
@@ Coverage Diff @@
## master #93 +/- ##
==========================================
+ Coverage 86.52% 86.84% +0.31%
==========================================
Files 39 41 +2
Lines 668 684 +16
Branches 102 103 +1
==========================================
+ Hits 578 594 +16
Misses 87 87
Partials 3 3
Continue to review full report at Codecov.
|
sorry in advance, maybe I am missing something. Could you, please, suggest if there is any way for me as a client of this functionality to explicitly provide division on rows - in a way similar to Semantic UI does: <Grid >
<Grid.Row>
.. elements here..
</Grid.Row>
<Grid.Row>
.. another elements here..
</Grid.Row>
</Grid> |
What are those extra letter classes? |
@kuzhelov no, this new Grid version does not have the concept of rows and columns as these are controlled with props; see proposal #11. Therefore, all we have are grid items (that can be any element as we do not have any constraints there); in the future we're probably going to add a |
@gaui Fella related classes that add the styles internally; if it's confusing I'm gonna delete them from the example as they are irrelevant there |
@levithomason removed |
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.
Per chat, let's only merge rows / columns for now. These props hit our use cases.
The itemSize
can be discussed in more detail later on subsequent PRs. It has some implications that will need collaboratively worked out before merging.
<div> | ||
<Grid content={images} /> | ||
</div> | ||
) |
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.
Wrapping div
is not required, this can be reduced to:
const GridExample = () => <Grid content={images} />
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.
done
|
||
const images = imageNames.map((name, index) => ( | ||
<Image key={`${name}-${index}`} fluid src={`public/images/avatar/large/${name}`} /> | ||
)) |
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.
Given the amount of code required to abstract and loop over the images, it would be less code and easier for users to scan if we inline the images:
<Image fluid src="public/images/avatar/large/ade.jpg" />
<Image fluid src="public/images/avatar/large/chris.jpg" />
<Image fluid src="public/images/avatar/large/christian.jpg" />
<Image fluid src="public/images/avatar/large/daniel.jpg" />
<Image fluid src="public/images/avatar/large/elliot.jpg" />
<Image fluid src="public/images/avatar/large/elyse.png" />
<Image fluid src="public/images/avatar/large/helen.jpg" />
<Image fluid src="public/images/avatar/large/jenny.jpg" />
<Image fluid src="public/images/avatar/large/joe.jpg" />
<Image fluid src="public/images/avatar/large/justen.jpg" />
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.
@levithomason
I have 20+ images in other grid examples to make it clear to users how the grid looks like ; duplicating 20+ lines in other places doesn't really make sense; do we want to change it only for these 2 examples (GridExample.shorthand.tsx
and GridExample.tsx
) ?
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.
The criteria for examples is concise and readable. We want them to fit on the minimal number of lines so that the can be easily viewed inline in the doc site. In cases where abstractions significantly reduce the amount code, then they are helpful and we should use them.
In the example here, given any number of images, the abstracted code will require more lines of code since each image path in the array already requires a line of code. Any lines required for abstraction are not needed.
In examples where the array of images is used more than once, then we'll certainly saves lines by abstracting. We should use an abstraction for those. However, you might consider removing the map
code and just creating an array of images once:
const images = [
<Image key="ade" fluid src="public/images/avatar/large/ade.jpg" />,
<Image key="chris" fluid src="public/images/avatar/large/chris.jpg" />,
<Image key="christian" fluid src="public/images/avatar/large/christian.jpg" />,
<Image key="daniel" fluid src="public/images/avatar/large/daniel.jpg" />,
<Image key="elliot" fluid src="public/images/avatar/large/elliot.jpg" />,
<Image key="elyse" fluid src="public/images/avatar/large/elyse.png" />,
<Image key="helen" fluid src="public/images/avatar/large/helen.jpg" />,
<Image key="jenny" fluid src="public/images/avatar/large/jenny.jpg" />,
<Image key="joe" fluid src="public/images/avatar/large/joe.jpg" />,
<Image key="justen" fluid src="public/images/avatar/large/justen.jpg" />,
]
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.
done
PropTypes.arrayOf(customPropTypes.itemShorthand), | ||
customPropTypes.itemShorthand, | ||
]), | ||
]), |
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.
In the case of a Grid component, I'm not sure content
makes sense. Perhaps here we only support children?
Why? There is no processing to be done on the content by Grid. It is also an "invisible" component in that it only formats children, but doesn't render its own subcomponents.
Thoughts?
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 agree with the reasons, but we have following things preventing us to do so:
- all components should support shorthand version; removing
content
breaks that pattern basically; it'd be the first component without shorthand support, right? - we were discussing introducing
GridItem
component for controlling individual items; maybe it'll make sense at that point
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, good points. We probably should not make those types of decisions in this PR. Let's keep it as is and we can discuss it in another. This would be a framework level design change.
src/themes/teams/componentStyles.ts
Outdated
export { default as List } from './components/List/listStyles' | ||
export { default as ListItem } from './components/List/listItemStyles' | ||
|
||
export { default as Menu } from './components/Menu/menuStyles' | ||
|
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.
Let's avoid unnecessary whitespace changes. It will make the PR smaller and prevent us from flip flopping on code style updates over time.
A good way to propose and implement style fixes is to make a PR introducing auto fixable lint rules or prettier config. This way, code style is automatic and enforced.
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 was just removing some random new lines, at least grouping by components with same letter; ok, I'll add my change only
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.
done
@levithomason I see some visual tests failing but I cannot login to this |
Send me the email you'd like to use on Screener privately and I'll add you. |
fa9b88a
to
888c4e5
Compare
@levithomason solved the screener issue with help from Miro. Everything is passing and I think I addressed all comments |
7c3ccac
to
c71be9c
Compare
Grid
This PR will introduce the Grid component with the following props:
columns=[number|string]
rows=[number|string]
The Grid will specify the layout of the elements it encapsulates as
children
or in thecontent
prop.See also:
https://css-tricks.com/snippets/css/complete-guide-grid/ - for CSS grid layout ramp-up
TODO
API Proposal
columns
We can specify a certain amount of columns:
or the explicit columns for a grid:
and
generate:
rows
We can specify a certain amount of rows:
or the explicit rows for a grid:
and
generate: