Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improvements for the theming scheme of the SDK #1499

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ef12a4d
feat: consolidate colors and variants in Theme
kristian-mkd Sep 26, 2024
4cf35b5
Merge branch 'main' into PBE-5856-feat/theme-consolidation
kristian-mkd Sep 27, 2024
89e4fd2
remove darkColors from defaultTheme and bring back the colorPalette
kristian-mkd Sep 27, 2024
ca8c956
Merge branch 'main' into PBE-5856-feat/theme-consolidation
kristian-mkd Sep 30, 2024
ad9a394
add theme defaults and getValue method
kristian-mkd Sep 30, 2024
66d324e
fix: improve theme color names and add useStyles hook
kristian-mkd Oct 1, 2024
fc86913
fix: remove some comments
kristian-mkd Oct 1, 2024
70411a4
fix: theme color corrections
kristian-mkd Oct 1, 2024
b6e03bc
feat: implement theme.get() and add unit tests
kristian-mkd Oct 1, 2024
b00a215
chore: add yarn.lock and podfile.lock changes
kristian-mkd Oct 1, 2024
bd11218
Merge branch 'main' into PBE-5856-feat/theme-consolidation
kristian-mkd Oct 1, 2024
c2b7605
fix: add new colors in the theme and fix theme object cloning
kristian-mkd Oct 2, 2024
74ba3cc
fix: revert local yarn.lock changes
kristian-mkd Oct 3, 2024
be7b426
fix: lint issue for used any type
kristian-mkd Oct 3, 2024
6d9cfbf
fix: warning Unexpected alias 'value' for 'this' consistent-this
kristian-mkd Oct 3, 2024
d1e2173
fix: lint warning
kristian-mkd Oct 3, 2024
2939717
fix: lint warning unnecessary initialized with undefined
kristian-mkd Oct 3, 2024
b5018a6
fix: unused import in dogfood app
kristian-mkd Oct 3, 2024
4dd3186
fix: remove not used customTheme in dogfood
kristian-mkd Oct 3, 2024
3497ff8
fix: lint error for imports
kristian-mkd Oct 3, 2024
7056cb8
chore: remove get method from theme and its tests
kristian-mkd Oct 4, 2024
300d812
Merge branch 'PBE-5855-feat/react-native-video-design-v2' into PBE-58…
kristian-mkd Oct 7, 2024
3f8ec26
revert not needed mergeThemes change
kristian-mkd Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const AcceptCallButton = ({
size={buttonSizes.lg}
style={acceptCallButton}
>
<Phone color={colors.static_white} />
<Phone color={colors.base1} />
</CallControlsButton>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const CallControls = ({
<View
style={[
styles.container,
{ backgroundColor: colors.static_grey },
{ backgroundColor: colors.base4 },
callControls.container,
landscapeStyles,
style,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ export const CallControlsButton = (
const pressableStyle: PressableProps['style'] = ({ pressed }) => [
styles.container,
{
backgroundColor: disabled
? colors.disabled
: colorProp || colors.static_white,
backgroundColor: disabled ? colors.disabled : colorProp || colors.base1,
opacity: pressed ? 0.2 : 1,
height: size || buttonSizes.sm,
width: size || buttonSizes.sm,
borderRadius: (size || buttonSizes.sm) / 2,
borderColor: colors.content_bg,
borderColor: colors.background1,
},
styleProp?.container ?? null,
container,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const ChatButton = ({
return (
<CallControlsButton onPress={onPressHandler} style={chatButton}>
<UnreadBadgeCountIndicator count={unreadBadgeCount} />
<Chat color={colors.static_black} />
<Chat color={colors.base5} />
</CallControlsButton>
);
};
Expand All @@ -63,7 +63,7 @@ const UnreadBadgeCountIndicator = ({
<Text
style={[
styles.chatBadgeText,
{ color: colors.static_white },
{ color: colors.base1 },
typefaces.subtitle,
]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const HangUpCallButton = ({
size={size}
testID={ButtonTestIds.HANG_UP_CALL}
>
<PhoneDown color={colors.static_white} />
<PhoneDown color={colors.base1} />
</CallControlsButton>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const ReactionsButton = ({
onPress={reactionsButtonHandler}
onLayout={onReactionsButtonLayout}
>
<Reaction color={colors.static_black} />
<Reaction color={colors.base5} />
</CallControlsButton>
</Restricted>
{showReactionsPicker && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const RejectCallButton = ({
// svgContainerStyle={theme.icon.lg}
style={rejectCallButton}
>
<PhoneDown color={colors.static_white} />
<PhoneDown color={colors.base1} />
</CallControlsButton>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ export const ScreenShareToggleButton = ({
return (
<CallControlsButton
onPress={onPress}
color={hasPublishedScreenShare ? colors.error : colors.static_white}
color={hasPublishedScreenShare ? colors.error : colors.base1}
style={{
container: screenShareToggleButton.container,
svgContainer: screenShareToggleButton.svgContainer,
}}
>
{hasPublishedScreenShare ? (
<StopScreenShare color={colors.static_black} />
<StopScreenShare color={colors.base5} />
) : (
<ScreenShare color={colors.static_black} />
<ScreenShare color={colors.base5} />
)}
{Platform.OS === 'ios' && (
<ScreenCapturePickerView ref={screenCapturePickerViewiOSRef} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,20 @@ export const ToggleAudioPreviewButton = ({
return (
<CallControlsButton
onPress={onPress}
color={!optimisticIsMute ? colors.static_white : colors.static_black}
color={!optimisticIsMute ? colors.base1 : colors.base5}
size={buttonSizes.md}
style={{
container: {
shadowColor: !optimisticIsMute
? colors.static_white
: colors.static_black,
shadowColor: !optimisticIsMute ? colors.base1 : colors.base5,
...toggleAudioPreviewButton.container,
},
svgContainer: toggleAudioPreviewButton.svgContainer,
}}
>
{!optimisticIsMute ? (
<Mic color={colors.static_black} />
<Mic color={colors.base5} />
) : (
<MicOff color={colors.static_white} />
<MicOff color={colors.base1} />
)}
</CallControlsButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export const ToggleAudioPublishingButton = ({
<Restricted requiredGrants={[OwnCapability.SEND_AUDIO]}>
<CallControlsButton
onPress={onPress}
color={!optimisticIsMute ? colors.static_white : colors.overlay_dark}
color={!optimisticIsMute ? colors.base1 : colors.background4}
style={toggleAudioPublishingButton}
>
{!optimisticIsMute ? (
<Mic color={colors.static_black} />
<Mic color={colors.base2} />
) : (
<MicOff color={colors.static_white} />
<MicOff color={colors.base1} />
)}
</CallControlsButton>
</Restricted>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const ToggleCameraFaceButton = ({
<Restricted requiredGrants={[OwnCapability.SEND_VIDEO]}>
<CallControlsButton
onPress={onPress}
color={direction === 'back' ? colors.overlay_dark : colors.static_white}
color={direction === 'back' ? colors.background4 : colors.base1}
disabled={optimisticIsMute}
style={toggleCameraFaceButton}
>
<CameraSwitch
color={
direction === 'front' || direction === undefined
? colors.static_black
: colors.static_white
? colors.base5
: colors.base1
}
/>
</CallControlsButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,20 @@ export const ToggleVideoPreviewButton = ({
return (
<CallControlsButton
onPress={onPress}
color={!optimisticIsMute ? colors.static_white : colors.static_black}
color={!optimisticIsMute ? colors.base1 : colors.base5}
size={buttonSizes.md}
style={{
container: {
shadowColor: !optimisticIsMute
? colors.static_white
: colors.static_black,
shadowColor: !optimisticIsMute ? colors.base1 : colors.base5,
...toggleVideoPreviewButton.container,
},
svgContainer: toggleVideoPreviewButton.svgContainer,
}}
>
{!optimisticIsMute ? (
<Video color={colors.static_black} />
<Video color={colors.base5} />
) : (
<VideoSlash color={colors.static_white} />
<VideoSlash color={colors.base1} />
)}
</CallControlsButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ export const ToggleVideoPublishingButton = ({
<Restricted requiredGrants={[OwnCapability.SEND_VIDEO]}>
<CallControlsButton
onPress={onPress}
color={!optimisticIsMute ? colors.static_white : colors.overlay_dark}
color={!optimisticIsMute ? colors.base1 : colors.background4}
>
{!optimisticIsMute ? (
<Video color={colors.static_black} />
<Video color={colors.base5} />
) : (
<VideoSlash color={colors.static_white} />
<VideoSlash color={colors.base1} />
)}
</CallControlsButton>
</Restricted>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import React, { useEffect, useMemo, useRef } from 'react';
import {
LayoutRectangle,
Pressable,
Expand All @@ -18,20 +18,20 @@ type ReactionPickerProps = Pick<ReactionsButtonProps, 'supportedReactions'> & {
onRequestedClose: () => void;
};

const TOP_PADDING = 4;
const REACTION_MARGIN_BOTTOM = 4;

export const ReactionsPicker = ({
supportedReactions = defaultEmojiReactions,
reactionsButtonLayoutRectangle,
onRequestedClose,
}: ReactionPickerProps) => {
const {
theme: { colors, reactionsPicker },
theme: { colors, reactionsPicker, variants },
} = useTheme();
const styles = useStyles();
const call = useCall();
const size = reactionsButtonLayoutRectangle?.width ?? 0;
const reactionItemSize = size * 0.8;
const TOP_PADDING = variants.spacingSizes.xs;
const REACTION_MARGIN_BOTTOM = variants.spacingSizes.xs;

const popupHeight =
// the top padding
Expand Down Expand Up @@ -104,7 +104,7 @@ export const ReactionsPicker = ({
styles.reactionsPopup,
reactionsPopupStyle,
{
backgroundColor: colors.static_grey,
backgroundColor: colors.base4,
},
reactionsPicker.reactionsPopup,
]}
Expand All @@ -120,8 +120,7 @@ export const ReactionsPicker = ({
styles.reactionItem,
reactionItemStyle,
{
// temporary background color until we have theming
backgroundColor: colors.overlay,
backgroundColor: colors.background3,
},
reactionsPicker.reactionItem,
]}
Expand Down Expand Up @@ -159,7 +158,7 @@ export const ReactionsPicker = ({
style={[
reactionsButtonDimmerStyle,
{
backgroundColor: colors.static_grey,
backgroundColor: colors.base4,
},
reactionsPicker.reactionsButtonDimmer,
]}
Expand All @@ -169,22 +168,29 @@ export const ReactionsPicker = ({
);
};

const styles = StyleSheet.create({
reactionsPopup: {
position: 'absolute',
alignItems: 'center',
paddingTop: TOP_PADDING,
},
reactionsButtonDimmer: {
position: 'absolute',
opacity: 0.5,
},
reactionItem: {
alignItems: 'center',
justifyContent: 'center',
marginBottom: REACTION_MARGIN_BOTTOM,
},
reactionText: {
fontSize: 18.5,
},
});
const useStyles = () => {
const { theme } = useTheme();
return useMemo(
() =>
StyleSheet.create({
reactionsPopup: {
position: 'absolute',
alignItems: 'center',
paddingTop: theme.variants.spacingSizes.xs,
},
reactionsButtonDimmer: {
position: 'absolute',
opacity: 0.5,
},
reactionItem: {
alignItems: 'center',
justifyContent: 'center',
marginBottom: theme.variants.spacingSizes.xs,
},
reactionText: {
fontSize: 18.5,
},
}),
[theme]
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const CallParticipantsGrid = ({
style={[
styles.container,
landscapeStyles,
{ backgroundColor: colors.dark_gray },
{ backgroundColor: colors.background2 },
callParticipantsGrid.container,
]}
testID={ComponentTestIds.CALL_PARTICIPANTS_GRID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const CallParticipantsSpotlight = ({
styles.container,
landscapeStyles,
{
backgroundColor: colors.dark_gray,
backgroundColor: colors.background2,
},
callParticipantsSpotlight.container,
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ export const CallTopView = ({
]}
onPress={onBackPressed}
>
<Back color={colors.static_white} />
<Back color={colors.base1} />
</Pressable>
)}
</View>
<View style={[styles.centerElement, callTopView.centerElement]}>
{title ? (
<Text
style={[
{ color: colors.static_white },
{ color: colors.base1 },
typefaces.subtitleBold,
callTopView.title,
]}
Expand All @@ -111,7 +111,7 @@ export const CallTopView = ({
isCallReconnecting && (
<Text
style={[
{ color: colors.static_white },
{ color: colors.base1 },
typefaces.subtitleBold,
callTopView.title,
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ export const ParticipantsInfoBadge = ({
participantInfoBadge.participantsIconContainer,
]}
>
<Participants color={colors.static_white} />
<Participants color={colors.base1} />
</View>
<View
style={[
styles.participantCountContainer,
{
backgroundColor: colors.text_low_emphasis,
backgroundColor: colors.base3,
},
participantInfoBadge.participantCountContainer,
]}
Expand All @@ -86,7 +86,7 @@ export const ParticipantsInfoBadge = ({
style={[
styles.participantCountText,
{
color: colors.static_white,
color: colors.base1,
},
typefaces.subtitle,
participantInfoBadge.participantsCountText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const JoinCallButton = ({
style={[
styles.label,
{
color: colors.static_white,
color: colors.base1,
},
typefaces.subtitleBold,
joinCallButton.label,
Expand Down
Loading
Loading