Skip to content

Commit 8c56753

Browse files
committed
Adds sentry branding (png logo)
1 parent c80c5cb commit 8c56753

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-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
@@ -10,7 +10,8 @@ const defaultStyles: FeedbackFormStyles = {
1010
fontSize: 24,
1111
fontWeight: 'bold',
1212
marginBottom: 20,
13-
textAlign: 'center',
13+
textAlign: 'left',
14+
flex: 1,
1415
},
1516
label: {
1617
marginBottom: 4,
@@ -49,6 +50,14 @@ const defaultStyles: FeedbackFormStyles = {
4950
color: '#6a1b9a',
5051
fontSize: 16,
5152
},
53+
titleContainer: {
54+
flexDirection: 'row',
55+
width: '100%',
56+
},
57+
sentryLogo: {
58+
width: 40,
59+
height: 40,
60+
},
5261
};
5362

5463
export default defaultStyles;

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { captureFeedback } from '@sentry/core';
22
import type { SendFeedbackParams } from '@sentry/types';
33
import * as React from 'react';
44
import type { KeyboardTypeOptions } from 'react-native';
5-
import { Alert, Text, TextInput, TouchableOpacity, View } from 'react-native';
5+
import { Alert, Image, Text, TextInput, TouchableOpacity, View } from 'react-native';
66

77
import { defaultConfiguration } from './defaults';
88
import defaultStyles from './FeedbackForm.styles';
@@ -78,7 +78,12 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
7878

7979
return (
8080
<View style={styles.container}>
81-
<Text style={styles.title}>{text.formTitle}</Text>
81+
<View style={styles.titleContainer}>
82+
<Text style={styles.title}>{text.formTitle}</Text>
83+
{config.showBranding && (
84+
<Image source={require('../../../assets/sentrylogo.png')} style={styles.sentryLogo} />
85+
)}
86+
</View>
8287

8388
{config.showName && (
8489
<>

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

Lines changed: 17 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,11 @@ export interface FeedbackFormProps extends FeedbackGeneralConfiguration, Feedbac
811
* General feedback configuration
912
*/
1013
export interface FeedbackGeneralConfiguration {
14+
/**
15+
* Show the Sentry branding
16+
*/
17+
showBranding?: boolean;
18+
1119
/**
1220
* Should the email field be required?
1321
*/
@@ -123,6 +131,9 @@ export interface FeedbackCallbacks {
123131
onFormClose?: () => void;
124132
}
125133

134+
/**
135+
* The styles for the feedback form
136+
*/
126137
export interface FeedbackFormStyles {
127138
container?: ViewStyle;
128139
title?: TextStyle;
@@ -133,8 +144,13 @@ export interface FeedbackFormStyles {
133144
submitText?: TextStyle;
134145
cancelButton?: ViewStyle;
135146
cancelText?: TextStyle;
147+
titleContainer?: ViewStyle;
148+
sentryLogo?: ImageStyle;
136149
}
137150

151+
/**
152+
* The state of the feedback form
153+
*/
138154
export interface FeedbackFormState {
139155
isVisible: boolean;
140156
name: string;

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

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

3232
// FeedbackGeneralConfiguration
33+
showBranding: true,
3334
isEmailRequired: false,
3435
isNameRequired: false,
3536
showEmail: true,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const defaultProps: FeedbackFormProps = {
3636
formError: 'Please fill out all required fields.',
3737
emailError: 'The email address is not valid.',
3838
successMessageText: 'Feedback success',
39+
showBranding: false,
3940
};
4041

4142
describe('FeedbackForm', () => {

0 commit comments

Comments
 (0)