Skip to content

Commit

Permalink
🎨 reuse text snippets and use description field #2652 (#2678)
Browse files Browse the repository at this point in the history
* 🎨 reuse text snippets and use description field

* 🎨 forgot one category label
  • Loading branch information
BorghildSelle authored Nov 15, 2024
1 parent 76e393b commit 1f9b518
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 192 deletions.
183 changes: 31 additions & 152 deletions sanityv3/schemas/textSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const groups = {
form: { title: 'Form', hidden: !Flags.HAS_FORMS },
cookie: { title: 'Cookie' },
others: { title: 'Others' },
common: { title: 'Common' },
}
const snippets: textSnippet = {
country_code_format: {
Expand Down Expand Up @@ -162,26 +163,11 @@ const snippets: textSnippet = {
defaultValue: 'Please choose one or more of the following',
group: groups.subscribeForm,
},
subscribe_form_first_name: {
title: 'First name',
defaultValue: 'First name',
group: groups.subscribeForm,
},
subscribe_form_name_validation: {
title: 'Name validation',
defaultValue: 'Please fill out your name',
group: groups.subscribeForm,
},
subscribe_form_email: {
title: 'Email',
defaultValue: 'Email',
group: groups.subscribeForm,
},
subscribe_form_email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.subscribeForm,
},
subscribe_form_general_news: {
title: 'General News',
defaultValue: 'General News',
Expand Down Expand Up @@ -255,31 +241,11 @@ const snippets: textSnippet = {
'Want the full picture? We’d love to share this content with you, but first you must accept {type1}, {type2} and {type3} cookies by enabling them in our cookie settings.',
group: groups.cookie,
},
contact_form_name: {
title: 'Name',
defaultValue: 'Name *',
group: groups.contactForm,
},
contact_form_name_placeholder: {
title: 'Name Placeholder',
defaultValue: 'Jane Doe',
group: groups.contactForm,
},
contact_form_email: {
title: 'Email',
defaultValue: 'Email *',
group: groups.contactForm,
},
contact_form_name_validation: {
title: 'Name validation',
defaultValue: 'Please fill out your name',
group: groups.contactForm,
},
contact_form_email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.contactForm,
},
contact_form_category: {
title: 'Category',
defaultValue: 'Category',
Expand All @@ -290,11 +256,6 @@ const snippets: textSnippet = {
defaultValue: 'How can we help you?',
group: groups.contactForm,
},
contact_form_how_to_help_placeholder: {
title: `Please don't enter any personal information`,
defaultValue: `Please don't enter any personal information`,
group: groups.contactForm,
},
contact_form_how_to_help_validation: {
title: 'Please let us know how we may help you',
defaultValue: 'Please let us know how we may help you',
Expand Down Expand Up @@ -340,37 +301,6 @@ const snippets: textSnippet = {
defaultValue: 'Submit form',
group: groups.contactForm,
},
pension_form_name: {
title: 'Name',
defaultValue: 'Name *',
group: groups.pensionForm,
},
pension_form_name_placeholder: {
title: 'Name Placeholder',
defaultValue: 'Jane Doe',
group: groups.pensionForm,
},
pension_form_name_validation: {
title: 'Name validation',
defaultValue: 'Please fill out your name',
group: groups.pensionForm,
},

pension_form_email: {
title: 'Email',
defaultValue: 'Email *',
group: groups.pensionForm,
},
pension_form_email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.pensionForm,
},
pension_form_category: {
title: 'Category',
defaultValue: 'Category',
group: groups.pensionForm,
},
pension_form_category_pension: {
title: 'Pension Category',
defaultValue: 'Pension',
Expand All @@ -386,35 +316,21 @@ const snippets: textSnippet = {
defaultValue: 'Other Pension/Insurance Related',
group: groups.pensionForm,
},

pension_form_what_is_your_request: {
title: 'What is your request?',
defaultValue: 'What is your request?',
group: groups.pensionForm,
},
pension_form_what_is_your_request_placeholder: {
title: `Requests Placeholder`,
defaultValue: `Please don't enter any personal information`,
group: groups.pensionForm,
},
pension_form_what_is_your_request_validation: {
title: 'Requests Validation',
defaultValue: 'Please let us know how we may help you',
group: groups.pensionForm,
},

pension_form_submit: {
title: 'Submit Button Text',
defaultValue: 'Submit Form',
group: groups.pensionForm,
},

pension_form_all_fields_mandatory: {
title: 'All fields with * are mandatory',
defaultValue: 'All fields with * are mandatory',
group: groups.pensionForm,
},

career_fair_form_organisation: {
title: 'Organisation',
defaultValue: 'School / Organisation',
Expand Down Expand Up @@ -456,11 +372,6 @@ const snippets: textSnippet = {
defaultValue: 'Email',
group: groups.careerFairForm,
},
career_fair_form_email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.careerFairForm,
},
career_fair_form_event: {
title: 'Event',
defaultValue: 'Event',
Expand Down Expand Up @@ -512,34 +423,6 @@ const snippets: textSnippet = {
defaultValue: 'Submit form',
group: groups.careerFairForm,
},

order_reports_form_name: {
title: 'Name',
defaultValue: 'Name',
group: groups.orderAnnualReportsForm,
},

order_reports_form_name_validation: {
title: 'Enter name',
defaultValue: 'Please enter your name',
group: groups.orderAnnualReportsForm,
},
order_reports_form_name_placeholder: {
title: 'Name placeholder',
defaultValue: 'Jane Doe',
group: groups.orderAnnualReportsForm,
},

order_reports_form_email: {
title: 'Email',
defaultValue: 'Email',
group: groups.orderAnnualReportsForm,
},
order_reports_form_email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.orderAnnualReportsForm,
},
order_reports_form_company: {
title: 'Company',
defaultValue: 'Company',
Expand Down Expand Up @@ -590,13 +473,11 @@ const snippets: textSnippet = {
defaultValue: 'Please enter your country',
group: groups.orderAnnualReportsForm,
},

order_reports_form_cta: {
title: 'CTA',
defaultValue: 'Order printed copies',
group: groups.orderAnnualReportsForm,
},

order_reports_form_choose: {
title: 'Choose validation',
defaultValue: 'Please select atleast one of the reports',
Expand All @@ -612,37 +493,6 @@ const snippets: textSnippet = {
defaultValue: 'Annual report (norwegian version)',
group: groups.orderAnnualReportsForm,
},
careers_contact_form_name: {
title: 'Name',
defaultValue: 'Your Name *',
group: groups.careerContactForm,
},

careers_contact_form_name_placeholder: {
title: 'Name Placeholder',
defaultValue: 'Jane Doe',
group: groups.careerContactForm,
},
careers_contact_form_email: {
title: 'Email',
defaultValue: 'Email',
group: groups.careerContactForm,
},
careers_contact_form_name_validation: {
title: 'Name validation',
defaultValue: 'Please fill out your name',
group: groups.careerContactForm,
},
careers_contact_form_email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.careerContactForm,
},
careers_contact_form_category: {
title: 'Category',
defaultValue: 'Category',
group: groups.careerContactForm,
},
careers_contact_form_questions: {
title: 'Type your questions',
defaultValue: 'Type your questions',
Expand Down Expand Up @@ -749,7 +599,6 @@ const snippets: textSnippet = {
defaultValue: 'Tick the box if you would like to send supporting documents, and we will get in touch with you',
group: groups.careerContactForm,
},

form_sending: {
title: 'Sending...',
defaultValue: 'Sending...',
Expand Down Expand Up @@ -937,6 +786,36 @@ const snippets: textSnippet = {
defaultValue: 'Filter',
group: groups.others,
},
name: {
title: 'Name',
defaultValue: 'Name',
group: groups.common,
},
email: {
title: 'Email',
defaultValue: 'Email',
group: groups.common,
},
category: {
title: 'Category',
defaultValue: 'Category',
group: groups.common,
},
name_validation: {
title: 'Name validation',
defaultValue: 'Please fill out your name',
group: groups.common,
},
email_validation: {
title: 'Email validation',
defaultValue: 'Please fill out a valid email address',
group: groups.common,
},
dont_enter_personal_info: {
title: `Please don't enter any personal information`,
defaultValue: `Please don't enter any personal information`,
group: groups.common,
},
}

type textSnippetGroup = { title: string; hidden?: boolean }
Expand Down
4 changes: 2 additions & 2 deletions web/pageComponents/topicPages/Form/CareerFairForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ const CareerFairForm = () => {
control={control}
rules={{
required: intl.formatMessage({
id: 'career_fair_form_email_validation',
id: 'email_validation',
defaultMessage: 'Please fill out a valid email address',
}),
pattern: {
value: /^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[\w!#$%&'*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,6}$/g,
message: intl.formatMessage({
id: 'career_fair_form_email_validation',
id: 'email_validation',
defaultMessage: 'Please fill out a valid email address',
}),
},
Expand Down
14 changes: 7 additions & 7 deletions web/pageComponents/topicPages/Form/ContactEquinorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const ContactEquinorForm = (props: ContactEquinorFormProps) => {
control={control}
rules={{
required: intl.formatMessage({
id: 'contact_form_name_validation',
id: 'name_validation',
defaultMessage: 'Please fill out your name',
}),
}}
Expand All @@ -137,7 +137,7 @@ const ContactEquinorForm = (props: ContactEquinorFormProps) => {
{...props}
id={name}
label={`${intl.formatMessage({
id: 'contact_form_name',
id: 'name',
defaultMessage: 'Name',
})}*`}
inputRef={ref}
Expand All @@ -154,13 +154,13 @@ const ContactEquinorForm = (props: ContactEquinorFormProps) => {
control={control}
rules={{
required: intl.formatMessage({
id: 'contact_form_email_validation',
id: 'email_validation',
defaultMessage: 'Please fill out a valid email address',
}),
pattern: {
value: /^[\w!#$%&'*+/=?`{|}~^-]+(?:\.[\w!#$%&'*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,6}$/g,
message: intl.formatMessage({
id: 'contact_form_email_validation',
id: 'email_validation',
defaultMessage: 'Please fill out a valid email address',
}),
},
Expand All @@ -172,7 +172,7 @@ const ContactEquinorForm = (props: ContactEquinorFormProps) => {
{...props}
id={name}
label={`${intl.formatMessage({
id: 'contact_form_email',
id: 'email',
defaultMessage: 'Email',
})}*`}
inputRef={ref}
Expand All @@ -195,7 +195,7 @@ const ContactEquinorForm = (props: ContactEquinorFormProps) => {
selectRef={ref}
id={name}
disabled={isHumanRightsRequest}
label={intl.formatMessage({ id: 'contact_form_category', defaultMessage: 'Category' })}
label={intl.formatMessage({ id: 'category', defaultMessage: 'Category' })}
>
<option>
{intl.formatMessage({ id: 'contact_form_ask_us', defaultMessage: 'Ask us a question' })}
Expand Down Expand Up @@ -254,7 +254,7 @@ const ContactEquinorForm = (props: ContactEquinorFormProps) => {
{...props}
id={name}
description={intl.formatMessage({
id: 'contact_form_how_to_help_placeholder',
id: 'dont_enter_personal_info',
defaultMessage: `Please don't enter any personal information`,
})}
label={`${intl.formatMessage({
Expand Down
Loading

0 comments on commit 1f9b518

Please sign in to comment.