-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Page] Add thumbnail and subtitle to Page #1880
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
Conversation
margin-right: spacing(tight); | ||
display: inline; | ||
|
||
& > * { |
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 want the metadata to be inline and DisplayText is block by default I needed to do this :(
Another option would be to simply make this an H1
and style it myself
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.
This looks good. The changes you made helps a lot 👍
/** thumbnail that precedes the title */ | ||
thumbnail?: | ||
| React.ReactElement<AvatarProps | ThumbnailProps> | ||
| React.SFC<React.SVGProps<SVGSVGElement>>; |
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.
How is this for valid types?
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.
💯
margin-right: spacing(tight); | ||
|
||
// stylelint-disable-next-line selector-max-combinators | ||
> * { |
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.
Display block on DisplayText
needs to display: inline
if there's meta data
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.
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.
This looks great, Dan!! Can you update the Page with all its elements
example to include the subtitle
and thumbnail
?
| React.SFC<React.SVGProps<SVGSVGElement>>; | ||
} | ||
|
||
export default function PageTitle({ |
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 this doesn't live outside of the /Page
directory, we can just call this Title
.
src/components/Page/components/Header/components/PageTitle/tests/PageTitle.test.tsx
Outdated
Show resolved
Hide resolved
src/components/Page/components/Header/components/PageTitle/tests/PageTitle.test.tsx
Outdated
Show resolved
Hide resolved
src/components/Page/components/Header/components/PageTitle/tests/PageTitle.test.tsx
Outdated
Show resolved
Hide resolved
<p>Page content</p> | ||
</Page> | ||
``` | ||
|
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 add an example for thumbnail
too.
Page with title thumbnail
Use when an image will help merchants identify the purpose of the page.
<Page
breadcrumbs={[{content: 'Products', url: '/products/31'}]}
title="3/4 inch Leather pet collar"
titleMetadata={<Badge status="success">Paid</Badge>}
thumbnail={<Thumbnail source="https://burst.shopifycdn.com/photos/black-leather-choker-necklace_373x@2x.jpg" alt="Black leather pet collar" />}
secondaryActions={[
{
content: 'Duplicate',
icon: DuplicateMinor
},
{
content: 'View',
icon: ViewMinor
},
]}
actionGroups={[
{
title: 'Promote',
actions: [{content: 'Share on Facebook'}],
},
{
title: 'More actions',
actions: [{content: 'Embed on a website'}],
},
]}
pagination={{
hasPrevious: true,
hasNext: true,
}}
>
<p>Page content</p>
</Page>
WHY are these changes introduced?
Fixes #1711 and adds a subtitle prop
WHAT is this pull request doing?
Add 2 props to page: Thumbnail and Subtitle.
We opted with props for now until we get time to investigate the best approach to have more composable components.
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes