diff --git a/app/soapbox/components/birthday_input.tsx b/app/soapbox/components/birthday_input.tsx index e263fb02e..fc9521ca0 100644 --- a/app/soapbox/components/birthday_input.tsx +++ b/app/soapbox/components/birthday_input.tsx @@ -109,7 +109,7 @@ const BirthdayInput: React.FC = ({ value, onChange, required }) ); }; - const handleChange = (date: Date) => onChange(new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0, 10)); + const handleChange = (date: Date) => onChange(date ? new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().slice(0, 10) : ''); return (
@@ -123,6 +123,7 @@ const BirthdayInput: React.FC = ({ value, onChange, required }) maxDate={maxDate} required={required} renderCustomHeader={renderCustomHeader} + isClearable={!required} />)}
diff --git a/app/soapbox/features/edit_profile/index.tsx b/app/soapbox/features/edit_profile/index.tsx index a2fc13b92..e17683940 100644 --- a/app/soapbox/features/edit_profile/index.tsx +++ b/app/soapbox/features/edit_profile/index.tsx @@ -25,6 +25,7 @@ import resizeImage from 'soapbox/utils/resize_image'; import ProfilePreview from './components/profile-preview'; import type { Account } from 'soapbox/types/entities'; +import BirthdayInput from 'soapbox/components/birthday_input'; /** * Whether the user is hiding their follows and/or followers. @@ -232,6 +233,10 @@ const EditProfile: React.FC = () => { }; }; + const handleBirthdayChange = (date: string) => { + updateData('birthday', date); + }; + const handleHideNetworkChange: React.ChangeEventHandler = e => { const hide = e.target.checked; @@ -315,12 +320,9 @@ const EditProfile: React.FC = () => { } > - )} diff --git a/app/styles/components/datepicker.scss b/app/styles/components/datepicker.scss index ed5a5d839..6d7552a80 100644 --- a/app/styles/components/datepicker.scss +++ b/app/styles/components/datepicker.scss @@ -3,7 +3,7 @@ } .react-datepicker__input-container > input { - @apply dark:bg-slate-800 dark:text-white block w-full sm:text-sm border-gray-300 dark:border-gray-600 rounded-md focus:ring-indigo-500 focus:border-indigo-500; + @apply dark:bg-slate-800 dark:text-white block w-full sm:text-sm border-gray-300 dark:border-gray-600 rounded-md focus:ring-primary-500 focus:border-primary-500; &.has-error { @apply text-red-600 border-red-600; @@ -132,3 +132,10 @@ .react-datepicker__year-text--keyboard-selected { @apply bg-primary-50 hover:bg-primary-100 dark:bg-slate-700 dark:hover:bg-slate-600 text-primary-600 dark:text-primary-400; } + +.react-datepicker__close-icon::after { + @apply bg-transparent text-gray-600 dark:text-gray-400 text-base; + font-family: 'Font Awesome 5 Free'; + content: ""; + font-weight: 900; +}