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

[MM-57263] Tweaks to expanded view #715

Merged
merged 7 commits into from
May 6, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions webapp/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"S2W9y3": "You're recording",
"SmSeXX": "Do you want to leave and join a call with {users}?",
"Ssxh83": "Unable to find a valid audio input device. Try plugging in an audio input device.",
"TAIiAz": "Click to stop",
"TDaF6J": "Dismiss",
"TdTXXf": "Learn more",
"Tg9Lia": "Calls is not currently enabled",
Expand Down
24 changes: 21 additions & 3 deletions webapp/src/components/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from 'react';
import React, {useState} from 'react';
import {useIntl} from 'react-intl';
import styled, {css} from 'styled-components';

export type Props = {
id: string,
text: string,
textSize: number,
lineHeight?: number,
icon: React.ReactNode,
hoverIcon?: React.ReactNode,
gap: number,
iconFill?: string,
bgColor?: string,
Expand All @@ -17,21 +19,36 @@ export type Props = {
}

export function Badge(props: Props) {
const [hoverState, setHoverState] = useState(false);

const toggleHover = () => {
setHoverState(!hoverState);
};

return (
<Container
onMouseEnter={toggleHover}
onMouseLeave={toggleHover}
data-testid={props.id}
$bgColor={props.bgColor}
$size={props.textSize}
$lineHeight={props.lineHeight || props.textSize}
$margin={props.margin}
$padding={props.padding}
$color={props.color}
>
{props.loading &&
<Spinner $size={props.textSize}/>
}
{!props.loading &&

{!props.loading && !hoverState &&
<Icon $fill={props.iconFill}>{props.icon}</Icon>
}

{!props.loading && hoverState &&
<Icon $fill={props.iconFill}>{props.hoverIcon || props.icon}</Icon>
}

<Text $gap={props.gap}>{props.text}</Text>
</Container>
);
Expand All @@ -40,6 +57,7 @@ export function Badge(props: Props) {
type ContainerProps = {
$bgColor?: string,
$size: number,
$lineHeight: number,
$margin?: string,
$padding?: string,
$color?: string,
Expand All @@ -54,7 +72,7 @@ const Container = styled.div<ContainerProps>`
margin: ${({$margin}) => $margin || 0};
padding: ${({$padding}) => $padding || 0};
font-size: ${({$size}) => $size}px;
line-height: ${({$size}) => $size}px;
line-height: ${({$lineHeight}) => $lineHeight}px;
color: ${({$color}) => $color || 'currentColor'};
`;

Expand Down
10 changes: 0 additions & 10 deletions webapp/src/components/expanded_view/component.scss

This file was deleted.

Loading
Loading