Skip to content

Commit

Permalink
fix custom fields look
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel-Therrien-Beslogic committed Nov 21, 2024
1 parent f5a5df2 commit 08e3193
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 27 deletions.
5 changes: 3 additions & 2 deletions canopeum_frontend/src/components/inputs/EmailTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, type InputHTMLAttributes, useState } from 'react'
import { type InputHTMLAttributes, useState } from 'react'
import { useTranslation } from 'react-i18next'

import { isValidEmail } from '@utils/validators'
Expand All @@ -10,7 +10,7 @@ type Props = {
readonly isValid: (valid: boolean) => void,
}

const EmailTextField: FC<Props> = props => {
const EmailTextField = (props: Props) => {
const { t } = useTranslation()
const [error, setError] = useState<string | null>(null)

Expand All @@ -31,6 +31,7 @@ const EmailTextField: FC<Props> = props => {
{/* eslint-disable react/jsx-props-no-spreading -- Needed for custom input */}
<input
{...props.attributes}
className='form-control'
onChange={event => handleChange(event.target.value)}
type='email'
value={props.value}
Expand Down
5 changes: 3 additions & 2 deletions canopeum_frontend/src/components/inputs/PhoneTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, type InputHTMLAttributes, useState } from 'react'
import { type InputHTMLAttributes, useState } from 'react'
import { useTranslation } from 'react-i18next'

import { isValidPhone } from '@utils/validators'
Expand All @@ -10,7 +10,7 @@ type Props = {
readonly isValid: (valid: boolean) => void,
}

const PhoneTextField: FC<Props> = props => {
const PhoneTextField = (props: Props) => {
const { t } = useTranslation()
const [error, setError] = useState<string | null>(null)

Expand All @@ -31,6 +31,7 @@ const PhoneTextField: FC<Props> = props => {
{/* eslint-disable react/jsx-props-no-spreading -- Needed for custom input */}
<input
{...props.attributes}
className='form-control'
onChange={event => handleChange(event.target.value)}
type='tel'
value={props.value}
Expand Down
5 changes: 3 additions & 2 deletions canopeum_frontend/src/components/inputs/UrlTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, type InputHTMLAttributes, useState } from 'react'
import { type InputHTMLAttributes, useState } from 'react'
import { useTranslation } from 'react-i18next'

import { isValidUrl } from '@utils/validators'
Expand All @@ -10,7 +10,7 @@ type Props = {
readonly isValid: (valid: boolean) => void,
}

const UrlTextField: FC<Props> = props => {
const UrlTextField = (props: Props) => {
const { t } = useTranslation()
const [error, setError] = useState<string | null>(null)

Expand All @@ -31,6 +31,7 @@ const UrlTextField: FC<Props> = props => {
{/* eslint-disable react/jsx-props-no-spreading -- Needed for custom input */}
<input
{...props.attributes}
className='form-control'
onChange={event => handleChange(event.target.value)}
type='url'
value={props.value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ const SiteAnnouncementModal = ({ announcement, isOpen, handleClose }: Props) =>
{t('social.announcement.link')}
</label>
<UrlTextField
attributes={{
id: 'link',
}}
attributes={{ id: 'link' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedAnnouncement(value => ({ ...value, link: eventValue }))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ const SiteContactModal = ({ contact, isOpen, handleClose }: Props) => {
{t('social.contact.email')}
</label>
<EmailTextField
attributes={{
id: 'email',
}}
attributes={{ id: 'email' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedContact(value => ({ ...value, email: eventValue }))}
Expand All @@ -90,9 +88,7 @@ const SiteContactModal = ({ contact, isOpen, handleClose }: Props) => {
{t('social.contact.phone')}
</label>
<PhoneTextField
attributes={{
id: 'phone',
}}
attributes={{ id: 'phone' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedContact(value => ({ ...value, phone: eventValue }))}
Expand All @@ -102,9 +98,7 @@ const SiteContactModal = ({ contact, isOpen, handleClose }: Props) => {
<div className='d-flex'>
<img alt='facebook-logo' className='px-2' src={facebookLogo} />
<UrlTextField
attributes={{
id: 'facebookLink',
}}
attributes={{ id: 'facebookLink' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedContact(value => ({ ...value, facebookLink: eventValue }))}
Expand All @@ -114,9 +108,7 @@ const SiteContactModal = ({ contact, isOpen, handleClose }: Props) => {
<div className='d-flex'>
<img alt='x-logo' className='px-2' src={xLogo} />
<UrlTextField
attributes={{
id: 'xLink',
}}
attributes={{ id: 'xLink' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedContact(value => ({ ...value, xLink: eventValue }))}
Expand All @@ -126,9 +118,7 @@ const SiteContactModal = ({ contact, isOpen, handleClose }: Props) => {
<div className='d-flex'>
<img alt='instagram-logo' className='px-2' src={instagramLogo} />
<UrlTextField
attributes={{
id: 'instagramLink',
}}
attributes={{ id: 'instagramLink' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedContact(value => ({ ...value, instagramLink: eventValue }))}
Expand All @@ -138,9 +128,7 @@ const SiteContactModal = ({ contact, isOpen, handleClose }: Props) => {
<div className='d-flex'>
<img alt='linkedin-logo' className='px-2' src={linkedinLogo} />
<UrlTextField
attributes={{
id: 'linkedinLink',
}}
attributes={{ id: 'linkedinLink' }}
isValid={value => setIsFormValid(value)}
onChange={eventValue =>
setEditedContact(value => ({ ...value, linkedinLink: eventValue }))}
Expand Down

0 comments on commit 08e3193

Please sign in to comment.