Merge pull request #162 from jedmund/fix-job-errors

Fix errors from props on HTML elements
This commit is contained in:
Justin Edmund 2023-01-28 03:53:04 -08:00 committed by GitHub
commit 308ae92957
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 3 deletions

View file

@ -158,6 +158,26 @@ const JobSection = (props: Props) => {
props.saveSkill(skill, position) props.saveSkill(skill, position)
} }
const emptyJobLabel = (
<div className="JobName">
<h3>{t('no_job')}</h3>
</div>
)
const filledJobLabel = (
<div className="JobName">
<img
alt={job?.name[locale]}
src={`/images/job-icons/${job?.granblue_id}.png`}
/>
<h3>{job?.name[locale]}</h3>
</div>
)
function jobLabel() {
return job ? filledJobLabel : emptyJobLabel
}
// Render: JSX components // Render: JSX components
return ( return (
<section id="Job"> <section id="Job">

View file

@ -11,7 +11,7 @@ interface Props extends ComponentProps<'div'> {
} }
const SelectItem = React.forwardRef<HTMLDivElement, Props>(function selectItem( const SelectItem = React.forwardRef<HTMLDivElement, Props>(function selectItem(
{ children, ...props }, { children, value, iconSrc, altText, ...props },
forwardedRef forwardedRef
) { ) {
const { altText, iconSrc, ...rest } = props const { altText, iconSrc, ...rest } = props
@ -20,9 +20,9 @@ const SelectItem = React.forwardRef<HTMLDivElement, Props>(function selectItem(
className={classNames('SelectItem', props.className)} className={classNames('SelectItem', props.className)}
{...rest} {...rest}
ref={forwardedRef} ref={forwardedRef}
value={`${props.value}`} value={`${value}`}
> >
{props.iconSrc ? <img alt={props.altText} src={props.iconSrc} /> : ''} {iconSrc ? <img alt={altText} src={iconSrc} /> : ''}
<Select.ItemText>{children}</Select.ItemText> <Select.ItemText>{children}</Select.ItemText>
</Select.Item> </Select.Item>
) )