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

feat(Persona): add style prop #855

Merged
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
3 changes: 3 additions & 0 deletions src/components/Persona/Persona.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface PersonaProps {
onClick?: (text: string) => void;
/** Custom CSS class for root element */
className?: string;
style?: React.CSSProperties;
}

export function Persona({
Expand All @@ -41,6 +42,7 @@ export function Persona({
text,
image,
className,
style,
}: PersonaProps) {
let avatar: React.ReactNode | null;

Expand All @@ -65,6 +67,7 @@ export function Persona({
onClose={onClose && onClose.bind(null, text)}
avatar={avatar}
className={className}
style={style}
>
{text}
</PersonaWrap>
Expand Down
7 changes: 6 additions & 1 deletion src/components/PersonaWrap/PersonaWrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface PersonaWrapProps {
onClose?: (event: React.MouseEvent) => void;
onClick?: (event: React.MouseEvent) => void;
className?: string;
style?: React.CSSProperties;
}

export function PersonaWrap({
Expand All @@ -29,11 +30,15 @@ export function PersonaWrap({
className,
avatar,
children,
style,
}: PersonaWrapProps) {
const clickable = Boolean(onClick);
const closeable = Boolean(onClose);
return (
<div className={b({size, theme, clickable, closeable, empty: isEmpty}, className)}>
<div
className={b({size, theme, clickable, closeable, empty: isEmpty}, className)}
style={style}
>
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
<div className={b('main')} onClick={onClick}>
{avatar && <div className={b('avatar')}>{avatar}</div>}
Expand Down
Loading