Add tooltips to header buttons

This commit is contained in:
Robert Long 2021-11-24 15:05:43 -08:00
commit 4588cca2b8
2 changed files with 19 additions and 3 deletions

View file

@ -137,6 +137,7 @@ export function HeaderButton({ on, className, children, ...rest }) {
export function SettingsButton(props) { export function SettingsButton(props) {
return ( return (
<HeaderButton {...props}> <HeaderButton {...props}>
<ButtonTooltip>Show Dev Tools</ButtonTooltip>
<SettingsIcon width={20} height={20} /> <SettingsIcon width={20} height={20} />
</HeaderButton> </HeaderButton>
); );
@ -145,6 +146,7 @@ export function SettingsButton(props) {
export function LayoutToggleButton({ layout, ...rest }) { export function LayoutToggleButton({ layout, ...rest }) {
return ( return (
<HeaderButton {...rest}> <HeaderButton {...rest}>
<ButtonTooltip className={styles.bottomRight}>Layout Type</ButtonTooltip>
{layout === "spotlight" ? ( {layout === "spotlight" ? (
<SpotlightIcon width={24} height={24} /> <SpotlightIcon width={24} height={24} />
) : ( ) : (
@ -154,6 +156,10 @@ export function LayoutToggleButton({ layout, ...rest }) {
); );
} }
export function ButtonTooltip({ children }) { export function ButtonTooltip({ className, children }) {
return <div className={styles.buttonTooltip}>{children}</div>; return (
<div className={classNames(styles.buttonTooltip, className)}>
{children}
</div>
);
} }

View file

@ -123,7 +123,6 @@ limitations under the License.
display: none; display: none;
background-color: var(--bgColor2); background-color: var(--bgColor2);
position: absolute; position: absolute;
bottom: calc(100% + 6px);
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -132,8 +131,19 @@ limitations under the License.
border-radius: 8px; border-radius: 8px;
max-width: 135px; max-width: 135px;
width: max-content; width: max-content;
z-index: 1;
}
.buttonTooltip.bottomRight {
right: 0;
} }
.roomButton:hover .buttonTooltip { .roomButton:hover .buttonTooltip {
display: flex; display: flex;
bottom: calc(100% + 6px);
}
.headerButton:hover .buttonTooltip {
display: flex;
top: calc(100% + 6px);
} }