mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-30 19:39:22 +00:00
Improve logic for settings button show/hide.
Fix button shown in appbar
This commit is contained in:
@@ -88,7 +88,7 @@ export const AppBar: FC<Props> = ({ children }) => {
|
|||||||
{title}
|
{title}
|
||||||
</Heading>
|
</Heading>
|
||||||
)}
|
)}
|
||||||
<RightNav>{secondaryButton ?? "x"}</RightNav>
|
<RightNav>{secondaryButton}</RightNav>
|
||||||
</Header>
|
</Header>
|
||||||
</div>
|
</div>
|
||||||
<AppBarContext value={context}>{children}</AppBarContext>
|
<AppBarContext value={context}>{children}</AppBarContext>
|
||||||
|
|||||||
@@ -160,26 +160,33 @@ export const LoudspeakerButton: FC<LoudspeakerButtonProps> = (props) => {
|
|||||||
|
|
||||||
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
size?: "sm" | "lg";
|
size?: "sm" | "lg";
|
||||||
/** If the button should be styled so it fits into the footer center buttons group
|
/** If the button should be styled so it fits into the footer center buttons group */
|
||||||
* This implies the button will be hidden unless we are on very small screens.
|
|
||||||
*/
|
|
||||||
forButtonsBar?: boolean;
|
forButtonsBar?: boolean;
|
||||||
|
/** If this buttons should be setup to be used in the app bar */
|
||||||
|
showForScreenWidth?: "wide" | "narrow";
|
||||||
}
|
}
|
||||||
export const SettingsButton: FC<SettingsButtonProps> = (props) => {
|
export const SettingsButton: FC<SettingsButtonProps> = ({
|
||||||
|
showForScreenWidth,
|
||||||
|
forButtonsBar,
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip label={t("common.settings")}>
|
<Tooltip label={t("common.settings")}>
|
||||||
<CpdButton
|
<CpdButton
|
||||||
className={classNames(props.className, {
|
className={classNames(className, {
|
||||||
[inCallViewStyles.settingForButtonsBar]: props.forButtonsBar,
|
[inCallViewStyles.settingsOnlyShowWide]:
|
||||||
[inCallViewStyles.settingForBottomLeftCorner]: !props.forButtonsBar,
|
showForScreenWidth === "wide",
|
||||||
|
[inCallViewStyles.settingsOnlyShowNarrow]:
|
||||||
|
showForScreenWidth === "narrow",
|
||||||
})}
|
})}
|
||||||
iconOnly
|
iconOnly
|
||||||
Icon={
|
Icon={
|
||||||
platform === "android" ? OverflowVerticalIcon : OverflowHorizontalIcon
|
platform === "android" ? OverflowVerticalIcon : OverflowHorizontalIcon
|
||||||
}
|
}
|
||||||
kind={props.forButtonsBar ? "secondary" : "tertiary"}
|
kind={forButtonsBar ? "secondary" : "tertiary"}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@@ -78,17 +78,10 @@ Please see LICENSE in the repository root for full details.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.settingForButtonsBar {
|
.settingsOnlyShowNarrow {
|
||||||
/*
|
|
||||||
never show the settings button for the buttons bar
|
|
||||||
show the settings button in the Buttons bar on width < 500px
|
|
||||||
*/
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.settingForBottomLeftCorner {
|
.settingsOnlyShowWide {
|
||||||
/*
|
|
||||||
show the settings button in the bottom left corner by default (will be hidden on width < 500px)
|
|
||||||
*/
|
|
||||||
display: inherit;
|
display: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,12 +94,13 @@ Once we exceed 500 we hide everything except the buttons.
|
|||||||
grid-template-areas: "buttons buttons buttons";
|
grid-template-areas: "buttons buttons buttons";
|
||||||
}
|
}
|
||||||
|
|
||||||
.settingForButtonsBar {
|
.settingsOnlyShowNarrow {
|
||||||
display: inherit;
|
display: inherit;
|
||||||
}
|
}
|
||||||
.settingForBottomLeftCorner {
|
.settingsOnlyShowWide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settingsLogoContainer {
|
.settingsLogoContainer {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,12 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
// add the settings button to the center group of buttons, so it will be visible on small screens.
|
// add the settings button to the center group of buttons, so it will be visible on small screens.
|
||||||
// On larger screens, it will be hidden and the one without `forButtonsBar` in the `settingsLogoContainer` will be visible.
|
// On larger screens, it will be hidden and the one without `forButtonsBar` in the `settingsLogoContainer` will be visible.
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<SettingsButton forButtonsBar key="settings" onClick={openSettings} />,
|
<SettingsButton
|
||||||
|
forButtonsBar
|
||||||
|
key="settings"
|
||||||
|
showForScreenWidth="narrow"
|
||||||
|
onClick={openSettings}
|
||||||
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,8 +162,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
if (audioOutputButton) buttons.push(audioOutputButton);
|
if (audioOutputButton) buttons.push(audioOutputButton);
|
||||||
|
|
||||||
useAppBarSecondaryButton(
|
useAppBarSecondaryButton(
|
||||||
// <SettingsButton key="settings" onClick={openSettings} />,
|
<SettingsButton key="settings" onClick={openSettings} />,
|
||||||
<div style={{ backgroundColor: "red", width: "20px", height: "20px" }} />,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
buttons.push(
|
buttons.push(
|
||||||
@@ -196,7 +200,11 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
>
|
>
|
||||||
<div className={styles.settingsLogoContainer}>
|
<div className={styles.settingsLogoContainer}>
|
||||||
{showSettingsButton && (
|
{showSettingsButton && (
|
||||||
<SettingsButton key="settings" onClick={openSettings} />
|
<SettingsButton
|
||||||
|
key="settings"
|
||||||
|
showForScreenWidth="wide"
|
||||||
|
onClick={openSettings}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showLogoDebugContainer && logoDebugContainer}
|
{showLogoDebugContainer && logoDebugContainer}
|
||||||
|
|||||||
Reference in New Issue
Block a user