Skip to content

Commit

Permalink
[MM-57263] Tweaks to expanded view (#715)
Browse files Browse the repository at this point in the history
* Tweaks to expanded view

* Update e2e snapshots

* Update translations

* More tweaks

* Fancy border

* Update e2e snapshots
  • Loading branch information
streamer45 authored May 6, 2024
1 parent 8296a2a commit bab17c3
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 87 deletions.
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

0 comments on commit bab17c3

Please sign in to comment.