Fix theme

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2021-12-18 10:10:23 +05:30
parent 9c12e11375
commit 85c3240b54
6 changed files with 38 additions and 29 deletions

View file

@ -22,7 +22,7 @@ function Avatar({
<div className={`avatar-container avatar-container__${size} noselect`}>
{
image !== null
? <img src={image} onError={() => updateImage(null)} alt="avatar" />
? <img draggable="false" src={image} onError={() => updateImage(null)} alt="avatar" />
: (
<span
style={{ backgroundColor: iconSrc === null ? bgColor : 'transparent' }}
@ -32,7 +32,7 @@ function Avatar({
iconSrc !== null
? <RawIcon size={size} src={iconSrc} color={iconColor} />
: text !== null && (
<Text variant={textSize} weight="medium" primary>
<Text variant={textSize} primary>
{twemojify([...text][0])}
</Text>
)

View file

@ -45,7 +45,7 @@
border-radius: inherit;
.text {
color: var(--bg-surface);
color: white;
}
}
}

View file

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import './Text.scss';
function Text({
className, variant, weight,
className, style, variant, weight,
primary, span, children,
}) {
const classes = [];
@ -13,15 +13,16 @@ function Text({
if (primary) classes.push('font-primary');
const textClass = classes.join(' ');
if (span) return <span className={classes.join(' ')}>{ children }</span>;
if (variant === 'h1') return <h1 className={textClass}>{ children }</h1>;
if (variant === 'h2') return <h2 className={textClass}>{ children }</h2>;
if (variant === 's1') return <h4 className={textClass}>{ children }</h4>;
return <p className={textClass}>{ children }</p>;
if (span) return <span className={textClass} style={style}>{ children }</span>;
if (variant === 'h1') return <h1 className={textClass} style={style}>{ children }</h1>;
if (variant === 'h2') return <h2 className={textClass} style={style}>{ children }</h2>;
if (variant === 's1') return <h4 className={textClass} style={style}>{ children }</h4>;
return <p className={textClass} style={style}>{ children }</p>;
}
Text.defaultProps = {
className: null,
style: null,
variant: 'b1',
weight: 'normal',
primary: false,
@ -30,6 +31,7 @@ Text.defaultProps = {
Text.propTypes = {
className: PropTypes.string,
style: PropTypes.shape({}),
variant: PropTypes.oneOf(['h1', 'h2', 's1', 'b1', 'b2', 'b3']),
weight: PropTypes.oneOf(['light', 'normal', 'medium', 'bold']),
primary: PropTypes.bool,