Skip to content

Commit 467da79

Browse files
Merge pull request #835 from strapi/enh/initials-ui-customization
[enh] Initials customization
2 parents f00d144 + 8137201 commit 467da79

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

packages/strapi-design-system/src/Avatar/Avatar.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,37 @@ const InitialsWrapper = styled(Flex)`
7070
}
7171
`;
7272

73-
export const Initials = ({ children }) => {
73+
export const Initials = ({ children, background, textColor }) => {
7474
return (
7575
<InitialsWrapper
76+
background={background}
7677
borderRadius="50%"
7778
width={`${avatarSize}px`}
7879
height={`${avatarSize}px`}
79-
background="primary600"
8080
justifyContent="center"
8181
>
82-
<Typography fontWeight="bold" textColor="buttonNeutral0" fontSize={0} textTransform="uppercase">
82+
<Typography fontSize={0} fontWeight="bold" textColor={textColor} textTransform="uppercase">
8383
{children}
8484
</Typography>
8585
</InitialsWrapper>
8686
);
8787
};
8888

89+
Initials.defaultProps = {
90+
background: 'primary600',
91+
textColor: 'buttonNeutral0',
92+
};
93+
8994
Initials.propTypes = {
95+
/**
96+
* Initials background, default is primary600
97+
*/
98+
background: PropTypes.string,
9099
children: PropTypes.node.isRequired,
100+
/**
101+
* Initials textColor, default is buttonNeutral0
102+
*/
103+
textColor: PropTypes.string,
91104
};
92105

93106
Avatar.defaultProps = {

packages/strapi-design-system/src/Avatar/Avatar.stories.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ The avatar has a feature to display a preview of its thumbnail.
5858
<Story name="initials">
5959
<Box padding={11}>
6060
<Initials>MF</Initials>
61+
<Initials background="secondary100" textColor="secondary600">MC</Initials>
6162
</Box>
6263
</Story>
6364
</Canvas>

0 commit comments

Comments
 (0)