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(surveys): added a customizable submit button text color #24170

Merged
merged 8 commits into from
Aug 5, 2024
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions frontend/src/scenes/surveys/SurveyCustomization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,23 @@ export function Customization({ appearance, surveyQuestionItem, onAppearanceChan
onChange={(submitButtonColor) => onAppearanceChange({ ...appearance, submitButtonColor })}
disabled={!surveysStylingAvailable}
/>
<div className="mt-2">Button text color</div>
<LemonInput
value={appearance?.submitButtonTextColor}
onChange={(submitButtonTextColor) => onAppearanceChange({ ...appearance, submitButtonTextColor })}
disabled={!surveysStylingAvailable}
/>
{surveyQuestionItem.type === SurveyQuestionType.Open && (
<>
<div className="mt-2">Placeholder</div>
<div className="mt-2">Placeholder text</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

imo this is clearer than just saying "Placeholder"

<LemonInput
value={appearance?.placeholder || defaultSurveyAppearance.placeholder}
onChange={(placeholder) => onAppearanceChange({ ...appearance, placeholder })}
disabled={!surveysStylingAvailable}
/>
</>
)}
<div className="mt-2">
<div className="mt-4">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

noticed that the customization elements seemed too crowded; added a little space here to let the different parts breathe.

Before:
image

After:
image

<LemonCheckbox
label={
<div className="flex items-center">
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/surveys/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const SurveyUrlMatchTypeLabels = {
export const defaultSurveyAppearance = {
backgroundColor: '#eeeded',
submitButtonColor: 'black',
submitButtonTextColor: 'white',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

default

ratingButtonColor: 'white',
ratingButtonActiveColor: 'black',
borderColor: '#c9c6c6',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/surveys/surveyActivityDescriber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const surveyActionsMapping: Record<
backgroundColor: 'background color',
submitButtonColor: 'submit button color',
submitButtonText: 'submit button text',
submitButtonTextColor: 'submit button text color',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added to the activity log

ratingButtonColor: 'rating button color',
ratingButtonActiveColor: 'active rating button color',
borderColor: 'border color',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,7 @@ export interface SurveyAppearance {
submitButtonColor?: string
// TODO: remove submitButtonText in favor of buttonText once it's more deprecated
submitButtonText?: string
submitButtonTextColor?: string
ratingButtonColor?: string
ratingButtonActiveColor?: string
borderColor?: string
Expand Down
Loading