-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from AppQuality/integrate-shortcut-tooltip
Integrate-shortcut-tooltip
- Loading branch information
Showing
13 changed files
with
274 additions
and
54 deletions.
There are no files selected for viewing
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,36 @@ | ||
import { ComponentProps } from "react"; | ||
import styled from "styled-components"; | ||
import { IconButton } from "../../buttons/icon-button"; | ||
import { Tooltip } from "../../tooltip"; | ||
import { PlayerShortCut } from "../shortcuts"; | ||
|
||
export const ControlButton = styled(IconButton)` | ||
type ShortcutType = ComponentProps<typeof PlayerShortCut>["type"]; | ||
|
||
const ControlButtonWithTooltip = ( | ||
props: ComponentProps<typeof IconButton> & { | ||
tooltip?: { | ||
description: string; | ||
type: ShortcutType; | ||
}; | ||
}, | ||
) => { | ||
if (!props.tooltip) return <IconButton {...props} />; | ||
return ( | ||
<Tooltip | ||
size="medium" | ||
maxWidth="unset" | ||
content={ | ||
<PlayerShortCut type={props.tooltip.type}> | ||
{props.tooltip.description} | ||
</PlayerShortCut> | ||
} | ||
type="light" | ||
> | ||
<IconButton {...props} /> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export const ControlButton = styled(ControlButtonWithTooltip)` | ||
color: ${({ theme }) => theme.palette.grey[700]}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.