-
Notifications
You must be signed in to change notification settings - Fork 1k
Calendar - add calendar[size].title
prop to theme
#6639
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
Calendar - add calendar[size].title
prop to theme
#6639
Conversation
I'm wondering if |
Good note, I'll see if I can find a different name for this |
renamed to titleSize |
})} | ||
</Heading> | ||
{theme.calendar.heading && theme.calendar[size].titleSize ? ( | ||
<Text weight="bold" size={theme.calendar[size].titleSize}> |
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.
Enforcing bold here might not be the best idea because in v5 of HPE theme, we are leaning away from use of bold in typography. Wondering if we should have theme.calendar[size].title
where any text props are supported?
In base.js, the default weight might be bold but then in HPE theme we can override with 500 or whatever is appropriate?
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.
good idea!
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.
Wondering if we should have theme.calendar[size].title where any text props are supported?
Done in latest commit
@@ -589,23 +590,36 @@ const Calendar = forwardRef( | |||
return ( | |||
<Box direction="row" justify="between" align="center"> |
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.
Any reason this isn't a <Header />
?
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.
Changed Box to Header in latest commit
year: 'numeric', | ||
})} | ||
</Heading> | ||
{theme.calendar.heading && theme.calendar[size].titleSize ? ( |
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.
Why do we need the check for theme.calendar.heading
?
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.
Removed this extra check in latest commit
</Heading> | ||
{theme.calendar.heading && theme.calendar[size].titleSize ? ( | ||
<Text weight="bold" size={theme.calendar[size].titleSize}> | ||
{reference.toLocaleDateString(locale, { |
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.
Since we're duplicating this code, can we put it in a const variable first?
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, fixed in latest commit
})} | ||
</Heading> | ||
{theme.calendar.heading && theme.calendar[size].titleSize ? ( | ||
<Text weight="bold" size={theme.calendar[size].titleSize}> |
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.
good idea!
calendar[size].headingSize
prop to themecalendar[size].title
prop to theme
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.
LGTM.
What does this PR do?
Adds a new prop
calendar[size].headingSize
to the theme. Specifying this prop will override thecalendar.heading.level
prop and change the calendar to use<Text>
instead of<Heading>
to display the date and year. This prop also gives the flexibility to specify different font sizes for each calendar size (small, medium, and large).In addition to this PR I will file a PR on grommet-theme-hpe to opt into this behavior for the hpe theme.
Where should the reviewer start?
What testing has been done on this PR?
Added a jest test and tested by adding a custom theme to calendar stories
How should this be manually tested?
Do Jest tests follow these best practices?
screen
is used for querying.userEvent
is used in place offireEvent
.asFragment()
is used for snapshot testing.Any background context you want to provide?
What are the relevant issues?
Related to #6637
Screenshots (if appropriate)
Do the grommet docs need to be updated?
Yes, we need to document the new theme prop as well as mention that using
calendar[size].headingSize
is preferred overcalendar.heading.level
Should this PR be mentioned in the release notes?
Yes
Is this change backwards compatible or is it a breaking change?
Backwards compatible