|
@@ -15,6 +15,12 @@ type CustomControlsProps = {
|
|
isEnded?: boolean
|
|
isEnded?: boolean
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+type ControlButtonProps = {
|
|
|
|
+ tooltipText?: string
|
|
|
|
+ tooltipPosition?: 'left' | 'right'
|
|
|
|
+ showTooltipOnlyOnFocus?: boolean
|
|
|
|
+}
|
|
|
|
+
|
|
const focusStyles = css`
|
|
const focusStyles = css`
|
|
:focus {
|
|
:focus {
|
|
/* Provide a fallback style for browsers
|
|
/* Provide a fallback style for browsers
|
|
@@ -58,7 +64,7 @@ export const CustomControls = styled.div<CustomControlsProps>`
|
|
transition: transform 200ms ${transitions.easing}, opacity 200ms ${transitions.easing};
|
|
transition: transform 200ms ${transitions.easing}, opacity 200ms ${transitions.easing};
|
|
`
|
|
`
|
|
|
|
|
|
-export const ControlButton = styled.button`
|
|
|
|
|
|
+export const ControlButton = styled.button<ControlButtonProps>`
|
|
margin-right: 0.5em;
|
|
margin-right: 0.5em;
|
|
display: flex !important;
|
|
display: flex !important;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
@@ -68,7 +74,8 @@ export const ControlButton = styled.button`
|
|
align-items: center;
|
|
align-items: center;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
padding: 0.5em;
|
|
padding: 0.5em;
|
|
- transition: background-color ${transitions.timings.player} ${transitions.easing} !important;
|
|
|
|
|
|
+ position: relative;
|
|
|
|
+ transition: background ${transitions.timings.player} ease-in !important;
|
|
|
|
|
|
& > svg {
|
|
& > svg {
|
|
filter: drop-shadow(0 1px 2px ${colors.transparentBlack[32]});
|
|
filter: drop-shadow(0 1px 2px ${colors.transparentBlack[32]});
|
|
@@ -76,15 +83,67 @@ export const ControlButton = styled.button`
|
|
height: 1.5em;
|
|
height: 1.5em;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ::before {
|
|
|
|
+ ${({ tooltipPosition }) => tooltipPosition === 'left' && 'left: 0'};
|
|
|
|
+ ${({ tooltipPosition }) => tooltipPosition === 'right' && 'right: 0'};
|
|
|
|
+
|
|
|
|
+ opacity: 0;
|
|
|
|
+ pointer-events: none;
|
|
|
|
+ content: ${({ tooltipText }) => tooltipText && `'${tooltipText}'`};
|
|
|
|
+ position: absolute;
|
|
|
|
+ font-size: 0.875em;
|
|
|
|
+ bottom: calc(3.5em - 1px);
|
|
|
|
+ background: ${colors.transparentBlack[54]};
|
|
|
|
+ backdrop-filter: blur(${sizes(8)});
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding: 0.5em;
|
|
|
|
+ white-space: nowrap;
|
|
|
|
+ transition: opacity ${transitions.timings.player} ease-in !important;
|
|
|
|
+ }
|
|
|
|
+
|
|
:hover {
|
|
:hover {
|
|
background-color: ${colors.transparentPrimary[18]};
|
|
background-color: ${colors.transparentPrimary[18]};
|
|
backdrop-filter: blur(${sizes(8)});
|
|
backdrop-filter: blur(${sizes(8)});
|
|
|
|
+ transition: none !important;
|
|
|
|
+
|
|
|
|
+ ::before {
|
|
|
|
+ transition: none !important;
|
|
|
|
+ opacity: ${({ showTooltipOnlyOnFocus }) => (showTooltipOnlyOnFocus ? 0 : 1)};
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
:active {
|
|
:active {
|
|
background-color: ${colors.transparentPrimary[10]};
|
|
background-color: ${colors.transparentPrimary[10]};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ :focus {
|
|
|
|
+ ::before {
|
|
|
|
+ /* turn off transition on mouse enter, but turn on on mouse leave */
|
|
|
|
+ transition: none !important;
|
|
|
|
+ opacity: 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ :focus-visible {
|
|
|
|
+ ::before {
|
|
|
|
+ opacity: 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ :focus:not(:focus-visible):hover {
|
|
|
|
+ ::before {
|
|
|
|
+ transition: none !important;
|
|
|
|
+ opacity: ${({ showTooltipOnlyOnFocus }) => (showTooltipOnlyOnFocus ? 0 : 1)};
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ :focus:not(:focus-visible):not(:hover) {
|
|
|
|
+ ::before {
|
|
|
|
+ opacity: 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
${focusStyles}
|
|
${focusStyles}
|
|
`
|
|
`
|
|
|
|
|
|
@@ -183,8 +242,10 @@ export const CurrentTime = styled(Text)`
|
|
`
|
|
`
|
|
|
|
|
|
export const ScreenControls = styled.div`
|
|
export const ScreenControls = styled.div`
|
|
|
|
+ display: grid;
|
|
|
|
+ grid-template-columns: auto auto;
|
|
|
|
+ gap: 0.5em;
|
|
margin-left: auto;
|
|
margin-left: auto;
|
|
- display: flex;
|
|
|
|
|
|
|
|
${ControlButton}:last-of-type {
|
|
${ControlButton}:last-of-type {
|
|
margin-right: 0;
|
|
margin-right: 0;
|