Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion packages/browser/src/extensions/surveys/survey.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
--ph-survey-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
--ph-survey-submit-button-color: black;
--ph-survey-submit-button-text-color: white;
--ph-survey-submit-button-radius: 6px;
--ph-survey-rating-bg-color: white;
--ph-survey-rating-text-color: #020617;
--ph-survey-rating-active-bg-color: black;
Expand Down Expand Up @@ -509,7 +510,7 @@
cursor: pointer;
user-select: none;
padding: 12px;
border-radius: 6px;
border-radius: var(--ph-survey-submit-button-radius);
background: var(--ph-survey-submit-button-color);
color: var(--ph-survey-submit-button-text-color);
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ export const defaultSurveyAppearance = {
backgroundColor: '#eeeded',
submitButtonColor: 'black',
submitButtonTextColor: 'white',
submitButtonRadius: '6px',
ratingButtonColor: 'white',
ratingButtonActiveColor: 'black',
borderColor: '#c9c6c6',
inputBackground: 'white',
placeholder: 'Start typing...',
whiteLabel: false,
displayThankYouMessage: true,
Expand All @@ -76,7 +78,6 @@ export const defaultSurveyAppearance = {
surveyPopupDelaySeconds: undefined,
// Not customizable atm
outlineColor: 'rgba(59, 130, 246, 0.8)',
inputBackground: 'white',
inputTextColor: BLACK_TEXT_COLOR,
scrollbarThumbColor: 'var(--ph-survey-border-color)',
scrollbarTrackColor: 'var(--ph-survey-background-color)',
Expand Down Expand Up @@ -118,6 +119,7 @@ export const addSurveyCSSVariablesToElement = (
'--ph-survey-submit-button-text-color',
appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)
)
hostStyle.setProperty('--ph-survey-submit-button-radius', effectiveAppearance.submitButtonRadius)
hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)
hostStyle.setProperty(
'--ph-survey-rating-text-color',
Expand All @@ -137,11 +139,6 @@ export const addSurveyCSSVariablesToElement = (
hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))
hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)

// Adjust input/choice background slightly if main background is white
if (effectiveAppearance.backgroundColor === 'white') {
hostStyle.setProperty('--ph-survey-input-background', '#f8f8f8')
}

hostStyle.setProperty('--ph-survey-input-background', effectiveAppearance.inputBackground)
hostStyle.setProperty('--ph-survey-input-text-color', getContrastingTextColor(effectiveAppearance.inputBackground))
hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)
Expand Down
4 changes: 3 additions & 1 deletion packages/browser/src/posthog-surveys-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ export interface SurveyAppearance {
// deprecate submit button text eventually
submitButtonText?: string
submitButtonTextColor?: string
submitButtonRadius?: string
descriptionTextColor?: string
ratingButtonColor?: string
ratingButtonActiveColor?: string
ratingButtonHoverColor?: string
inputBackground?: string
placeholder?: string
whiteLabel?: boolean
autoDisappear?: boolean
displayThankYouMessage?: boolean
Expand All @@ -47,7 +50,6 @@ export interface SurveyAppearance {
thankYouMessageCloseButtonText?: string
borderColor?: string
position?: SurveyPosition
placeholder?: string
shuffleQuestions?: boolean
surveyPopupDelaySeconds?: number
// widget options
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,11 @@ export type SurveyAppearance = {
// deprecate submit button text eventually
submitButtonText?: string
submitButtonTextColor?: string
submitButtonRadius?: string
ratingButtonColor?: string
ratingButtonActiveColor?: string
inputBackground?: string
placeholder?: string
autoDisappear?: boolean
displayThankYouMessage?: boolean
thankYouMessageHeader?: string
Expand All @@ -293,7 +296,6 @@ export type SurveyAppearance = {
thankYouMessageCloseButtonText?: string
borderColor?: string
position?: SurveyPosition
placeholder?: string
shuffleQuestions?: boolean
surveyPopupDelaySeconds?: number
// widget options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function BottomSection({
<TouchableOpacity
style={[
styles.button,
{ backgroundColor: appearance.submitButtonColor },
{ backgroundColor: appearance.submitButtonColor, borderRadius: appearance.submitButtonRadius },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Ensure appearance.submitButtonRadius has a fallback value to prevent undefined border radius

Suggested change
{ backgroundColor: appearance.submitButtonColor, borderRadius: appearance.submitButtonRadius },
{ backgroundColor: appearance.submitButtonColor, borderRadius: appearance.submitButtonRadius || 5 },
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-native/src/surveys/components/BottomSection.tsx
Line: 24:24

Comment:
**logic:** Ensure `appearance.submitButtonRadius` has a fallback value to prevent undefined border radius

```suggestion
          { backgroundColor: appearance.submitButtonColor, borderRadius: appearance.submitButtonRadius || 5 },
```

How can I resolve this? If you propose a fix, please make it concise.

submitDisabled && styles.buttonDisabled,
]}
disabled={submitDisabled}
Expand All @@ -48,7 +48,6 @@ const styles = StyleSheet.create({
},
button: {
padding: 10,
borderRadius: 5,
alignItems: 'center',
},
buttonText: {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/src/surveys/surveys-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ export const defaultSurveyAppearance: SurveyAppearanceTheme = {
submitButtonColor: 'black',
submitButtonTextColor: 'white',
ratingButtonColor: 'white',
submitButtonRadius: '6px',
ratingButtonActiveColor: 'black',
borderColor: '#c9c6c6',
inputBackground: 'white',
placeholder: 'Start typing...',
displayThankYouMessage: true,
thankYouMessageHeader: 'Thank you for your feedback!',
Expand Down
Loading