Skip to content

Commit 37635cb

Browse files
authored
Merge 1350545 into fd2e317
2 parents fd2e317 + 1350545 commit 37635cb

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

packages/core/src/js/feedback/FeedbackForm.styles.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const defaultStyles: FeedbackFormStyles = {
1515
fontSize: 24,
1616
fontWeight: 'bold',
1717
marginBottom: 20,
18-
textAlign: 'center',
18+
textAlign: 'left',
19+
flex: 1,
1920
color: FORGROUND_COLOR,
2021
},
2122
label: {
@@ -57,6 +58,14 @@ const defaultStyles: FeedbackFormStyles = {
5758
color: FORGROUND_COLOR,
5859
fontSize: 16,
5960
},
61+
titleContainer: {
62+
flexDirection: 'row',
63+
width: '100%',
64+
},
65+
sentryLogo: {
66+
width: 40,
67+
height: 40,
68+
},
6069
};
6170

6271
export default defaultStyles;

packages/core/src/js/feedback/FeedbackForm.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as React from 'react';
44
import type { KeyboardTypeOptions } from 'react-native';
55
import {
66
Alert,
7+
Image,
78
Keyboard,
89
KeyboardAvoidingView,
910
SafeAreaView,
@@ -103,7 +104,16 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
103104
<ScrollView>
104105
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
105106
<View style={styles.container}>
106-
<Text style={styles.title}>{text.formTitle}</Text>
107+
<View style={styles.titleContainer}>
108+
<Text style={styles.title}>{text.formTitle}</Text>
109+
{config.showBranding && (
110+
<Image
111+
source={{ uri: 'https://sentry-brand.storage.googleapis.com/sentry-glyph-black.png' }}
112+
style={styles.sentryLogo}
113+
testID='sentry-logo'
114+
/>
115+
)}
116+
</View>
107117

108118
{config.showName && (
109119
<>

packages/core/src/js/feedback/FeedbackForm.types.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import type { TextStyle, ViewStyle } from 'react-native';
1+
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
22

3+
/**
4+
* The props for the feedback form
5+
*/
36
export interface FeedbackFormProps extends FeedbackGeneralConfiguration, FeedbackTextConfiguration, FeedbackCallbacks {
47
styles?: FeedbackFormStyles;
58
}
@@ -8,6 +11,13 @@ export interface FeedbackFormProps extends FeedbackGeneralConfiguration, Feedbac
811
* General feedback configuration
912
*/
1013
export interface FeedbackGeneralConfiguration {
14+
/**
15+
* Show the Sentry branding
16+
*
17+
* @default true
18+
*/
19+
showBranding?: boolean;
20+
1121
/**
1222
* Should the email field be required?
1323
*/
@@ -128,6 +138,9 @@ export interface FeedbackCallbacks {
128138
onFormClose?: () => void;
129139
}
130140

141+
/**
142+
* The styles for the feedback form
143+
*/
131144
export interface FeedbackFormStyles {
132145
container?: ViewStyle;
133146
title?: TextStyle;
@@ -138,8 +151,13 @@ export interface FeedbackFormStyles {
138151
submitText?: TextStyle;
139152
cancelButton?: ViewStyle;
140153
cancelText?: TextStyle;
154+
titleContainer?: ViewStyle;
155+
sentryLogo?: ImageStyle;
141156
}
142157

158+
/**
159+
* The state of the feedback form
160+
*/
143161
export interface FeedbackFormState {
144162
isVisible: boolean;
145163
name: string;

packages/core/src/js/feedback/defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const defaultConfiguration: Partial<FeedbackFormProps> = {
2929
},
3030

3131
// FeedbackGeneralConfiguration
32+
showBranding: true,
3233
isEmailRequired: false,
3334
shouldValidateEmail: true,
3435
isNameRequired: false,

packages/core/test/feedback/FeedbackForm.test.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ describe('FeedbackForm', () => {
4545
});
4646

4747
it('renders correctly', () => {
48-
const { getByPlaceholderText, getByText } = render(<FeedbackForm {...defaultProps} />);
48+
const { getByPlaceholderText, getByText, getByTestId } = render(<FeedbackForm {...defaultProps} />);
4949

5050
expect(getByText(defaultProps.formTitle)).toBeTruthy();
51+
expect(getByTestId('sentry-logo')).toBeTruthy(); // default showBranding is true
5152
expect(getByText(defaultProps.nameLabel)).toBeTruthy();
5253
expect(getByPlaceholderText(defaultProps.namePlaceholder)).toBeTruthy();
5354
expect(getByText(defaultProps.emailLabel)).toBeTruthy();
@@ -58,6 +59,12 @@ describe('FeedbackForm', () => {
5859
expect(getByText(defaultProps.cancelButtonLabel)).toBeTruthy();
5960
});
6061

62+
it('does not render the sentry logo when showBranding is false', () => {
63+
const { queryByTestId } = render(<FeedbackForm {...defaultProps} showBranding={false} />);
64+
65+
expect(queryByTestId('sentry-logo')).toBeNull();
66+
});
67+
6168
it('name and email are prefilled when sentry user is set', () => {
6269
const { getByPlaceholderText } = render(<FeedbackForm {...defaultProps} />);
6370

0 commit comments

Comments
 (0)