Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(alert): add Header and Icon slots #1821

Merged
merged 40 commits into from
Aug 23, 2019
Merged

Conversation

lucivpav
Copy link
Contributor

@lucivpav lucivpav commented Aug 19, 2019

This PR adds an ability to specify header and icon props when using an Alert component.
Example:
image

@vercel vercel bot temporarily deployed to staging August 19, 2019 12:50 Inactive
@codecov
Copy link

codecov bot commented Aug 19, 2019

Codecov Report

Merging #1821 into master will decrease coverage by 0.02%.
The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1821      +/-   ##
==========================================
- Coverage   69.66%   69.64%   -0.03%     
==========================================
  Files         874      874              
  Lines        7608     7612       +4     
  Branches     2243     2216      -27     
==========================================
+ Hits         5300     5301       +1     
- Misses       2300     2303       +3     
  Partials        8        8
Impacted Files Coverage Δ
...rc/themes/teams/components/Alert/alertVariables.ts 0% <ø> (ø) ⬆️
...t/src/themes/teams/components/Alert/alertStyles.ts 6.45% <0%> (-0.7%) ⬇️
packages/react/src/components/Alert/Alert.tsx 80.95% <100%> (+0.95%) ⬆️
...essibility/Behaviors/Alert/alertWarningBehavior.ts 100% <100%> (ø) ⬆️
...lib/accessibility/Behaviors/Alert/alertBehavior.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6178279...84f2718. Read the comment docs.

@vercel vercel bot temporarily deployed to staging August 19, 2019 14:14 Inactive
@vercel vercel bot temporarily deployed to staging August 19, 2019 14:15 Inactive
bodyId?: string
}

export default AlertProps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please clarify why we need to move out types?..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because both alertBehavior.ts and alertWarningBehavior.ts depends on it.

Copy link
Member

@layershifter layershifter Aug 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep them alertBehavior.ts?

Copy link
Contributor Author

@lucivpav lucivpav Aug 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it to alertWarningBehavior to avoid circular dependency (alertBehavior imports alertWarningBehavior)

...accessibility.attributes.content,
className: Alert.slotClassNames.icon,
styles: styles.icon,
xSpacing: 'after',
Copy link
Member

@layershifter layershifter Aug 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xSpacing: 'after',

We can move this to styles instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But xSpacing is a prop of Icon. If I set it in styles prop, the value is not taken into account.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem for styles

It's just a margin value. We should avoid styling via props as it created hidden dependencies. We have already discussed this problem and it's related to children API.

<Alert icon="book" />
// This things look equal 🤔 
// But rendered result will be different as there are no matching styles for it
<Alert>
  <Icon name="book" />  
</Alert>
// With usage component props we are making it even more complicated

To coupled

If horizontalSpace variable in IconVariables will be changed, it will accidentally affect this component. Will be it valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@vercel vercel bot temporarily deployed to staging August 23, 2019 10:16 Inactive
@vercel vercel bot temporarily deployed to staging August 23, 2019 10:22 Inactive
@vercel vercel bot temporarily deployed to staging August 23, 2019 10:27 Inactive
@vercel vercel bot temporarily deployed to staging August 23, 2019 10:27 Inactive
<>
{Box.create(header, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to Text

@vercel vercel bot temporarily deployed to staging August 23, 2019 10:43 Inactive
@lucivpav lucivpav merged commit cc37b82 into master Aug 23, 2019
@delete-merged-branch delete-merged-branch bot deleted the feat/alert-header-and-icon branch August 23, 2019 11:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants