-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Box replacement (#224) * added ActionButton, Icon, Input Signed-off-by: Abhinav Kumar <[email protected]> improve auth Signed-off-by: Abhinav Kumar <[email protected]> added apis for slash, ui-iteractions, action-trigger Signed-off-by: Abhinav Kumar <[email protected]> slash-commands+ui-kit+theming Signed-off-by: Abhinav Kumar <[email protected]> slash-commands+ui-kit+theming * html-embedd Signed-off-by: Abhinav Kumar <[email protected]> * new/message-component+avatar Signed-off-by: Abhinav Kumar <[email protected]> --------- Signed-off-by: Abhinav Kumar <[email protected]>
- Loading branch information
1 parent
21d88ac
commit d1c70ca
Showing
23 changed files
with
847 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { css } from '@emotion/react'; | ||
import React from 'react'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
import { AvatarContainer } from './AvatarContainer'; | ||
|
||
export const Avatar = ({ | ||
size = '2.25rem', | ||
className = '', | ||
style = {}, | ||
url, | ||
...props | ||
}) => { | ||
const AvatarCss = css` | ||
border-radius: 0.25rem; | ||
height: ${size}; | ||
width: ${size}; | ||
`; | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'Avatar', | ||
className, | ||
style | ||
); | ||
|
||
return ( | ||
<AvatarContainer size={size} {...props}> | ||
<img | ||
src={`${url}`} | ||
css={AvatarCss} | ||
className={classNames} | ||
style={styleOverrides} | ||
/> | ||
</AvatarContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { css } from '@emotion/react'; | ||
import React from 'react'; | ||
import { appendClassNames } from '../../lib/appendClassNames'; | ||
import useComponentOverrides from '../../theme/useComponentOverrides'; | ||
import { Box } from '../Box'; | ||
|
||
export const AvatarContainer = ({ | ||
title, | ||
children, | ||
className = '', | ||
style = {}, | ||
...props | ||
}) => { | ||
const AvatarContainerCSS = css` | ||
display: inline-flex; | ||
vertical-align: middle; | ||
cursor: pointer; | ||
`; | ||
const { classNames, styleOverrides } = useComponentOverrides( | ||
'AvatarContainer', | ||
className, | ||
style | ||
); | ||
props.className = appendClassNames('ec-avatar-container', [classNames]); | ||
|
||
props.style = styleOverrides; | ||
|
||
return ( | ||
<Box is="figure" css={AvatarContainerCSS} aria-label={title} {...props}> | ||
{children} | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Avatar'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.