The following code puts an icon inside a circle:
<div className={classNames.left}>
<div className={classNames.icon}><AddFriendIcon /> </div>
<div> Add a Friend </div>
</div>
left: {
float: 'left'
},
icon: {
border: "solid 2px",
borderRadius: 10,
}
The result is not as expected.
Update: Based on the below solution, I got it working. But I'm still unable to put the icon in the center of the circle and the icon & circle are not in the center of the banner:
Now, I have the following code to put an icon inside a circle and in the center of the circle. The icon is still not in the center and the circle is not aligned to 'Cafe'.
<div className={classNames.root} role="banner" aria-label="header">
<div className={classNames.tabContent}> <div className={classNames.circle}><div className={classNames.icon}><CafeIcon /></div> </div> </div>
<div className={classNames.tabContent}> Cafe </div>
</div>
root: [
{
backgroundColor: theme.palette.themePrimary,
height: 40,
color: 'white',
maxWidth: "100%",
margin: '0 auto',
borderBottom: '1px solid transparent',
boxSizing: 'border-box',
paddingLeft: 20,
paddingTop: 10
},
className
],
circle: {
border: 'solid 2px',
borderRadius: '50%',
background: 'white',
height: 20,
width: 20,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
},
tabContent: {
color: 'white',
float: 'left',
border: 'none',
outline: 'none',
cursor: 'pointer',
paddingLeft: 15
},
icon: {
color: '#0078d7'
}