diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-09-16 21:37:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-16 21:37:33 +0100 |
commit | 8241747fc22bb4363ff6cf48d54013cc72db7624 (patch) | |
tree | e6cd31d82100fb9c99f3443d7b2753672b55373c /src/view/com/util/post-embeds/VideoEmbedInner/web-controls/ControlButton.tsx | |
parent | 38c8f01594ff515fbe49d00a777d70449e804fd4 (diff) | |
download | voidsky-8241747fc22bb4363ff6cf48d54013cc72db7624.tar.zst |
[Video] Volume controls on web (#5363)
* split up VideoWebControls * add basic slider * logarithmic volume * integrate mute state * fix typo * shared video volume * rm log * animate in/out * disable for touch devices * remove flicker on touch devices * more detailed comment * move into correct context provider * add minHeight * hack * bettern umber --------- Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/view/com/util/post-embeds/VideoEmbedInner/web-controls/ControlButton.tsx')
-rw-r--r-- | src/view/com/util/post-embeds/VideoEmbedInner/web-controls/ControlButton.tsx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/ControlButton.tsx b/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/ControlButton.tsx new file mode 100644 index 000000000..36b32a072 --- /dev/null +++ b/src/view/com/util/post-embeds/VideoEmbedInner/web-controls/ControlButton.tsx @@ -0,0 +1,39 @@ +import React from 'react' +import {SvgProps} from 'react-native-svg' + +import {atoms as a, useTheme} from '#/alf' +import {Button} from '#/components/Button' + +export function ControlButton({ + active, + activeLabel, + inactiveLabel, + activeIcon: ActiveIcon, + inactiveIcon: InactiveIcon, + onPress, +}: { + active: boolean + activeLabel: string + inactiveLabel: string + activeIcon: React.ComponentType<Pick<SvgProps, 'fill' | 'width'>> + inactiveIcon: React.ComponentType<Pick<SvgProps, 'fill' | 'width'>> + onPress: () => void +}) { + const t = useTheme() + return ( + <Button + label={active ? activeLabel : inactiveLabel} + onPress={onPress} + variant="ghost" + shape="round" + size="medium" + style={a.p_2xs} + hoverStyle={{backgroundColor: 'rgba(255, 255, 255, 0.1)'}}> + {active ? ( + <ActiveIcon fill={t.palette.white} width={20} /> + ) : ( + <InactiveIcon fill={t.palette.white} width={20} /> + )} + </Button> + ) +} |