Skip to content
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

[FX-121] Add support for Safari with clip-path #150

Merged
merged 3 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified components/Avatar/__image_snapshots__/avatar-default-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified components/Avatar/__image_snapshots__/avatar-sizes-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified components/Avatar/__image_snapshots__/avatar-variants-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion components/Avatar/story/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import PicassoBook from '../../../.storybook/components/PicassoBook'
import { Avatar } from '../Avatar'

const page = PicassoBook.createPage('Avatar', `Profile photo.`)
const page = PicassoBook.createPage(
'Avatar',
`
Profile photo.

 
 
Additional notes:
* The shape of clipped corner has a fallback for <=IE11, Edge to just a rectangle
`
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add for this field also markdown support in storybook. Maybe not this PR but new ticket.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we do have markdown support for the Description now :) or which one you mean?

Copy link
Contributor

@vedrani vedrani Apr 8, 2019

Choose a reason for hiding this comment

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

Ok, cool, but why do you need &nbsp;?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@vedrani this is the only one way to add new-line in this react-markdown :( and it's not just &nbsp;, but &nbsp; (with two spaces in the end)... I know.. but it works :) nothing else didn't what I've tried, like multiple enters, <br/>, , \r\n, none of them :(


page
.addComponentDocs(Avatar)
Expand Down
11 changes: 8 additions & 3 deletions components/Avatar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Theme, createStyles } from '@material-ui/core/styles'
const getClipPathCornerMask = (cornerWidth: string) =>
`polygon(0 0, 100% 0, 100% 100%, ${cornerWidth} 100%, 0 calc(100% - ${cornerWidth}))`

const CLIPPED_CORNER_SIZE = '0.5em'

export default ({ palette }: Theme) =>
createStyles({
root: {
Expand Down Expand Up @@ -36,7 +38,10 @@ export default ({ palette }: Theme) =>
fontSize: '4.5rem'
},
clippedCorner: {
clipPath: getClipPathCornerMask('0.3em')
clipPath: getClipPathCornerMask(CLIPPED_CORNER_SIZE),
// we can remove this prefix as soon as this issue will
// be resolved - https://github.com/cssinjs/css-vendor/issues/74
'-webkit-clip-path': getClipPathCornerMask(CLIPPED_CORNER_SIZE)
},
textContainer: {
backgroundColor: palette.grey[200]
Expand All @@ -54,7 +59,7 @@ export default ({ palette }: Theme) =>
position: 'absolute',
height: '0.45712em',
width: '0.4em',
bottom: '0.3em',
left: '0.3em'
bottom: CLIPPED_CORNER_SIZE,
left: CLIPPED_CORNER_SIZE
}
})