All files / src/components/layouts About.tsx

98.19% Statements 109/111
88.57% Branches 31/35
93.75% Functions 30/32
99.04% Lines 104/105

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 7001x 1x 1x                 1x                     1x                                         1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x   1x 11x 11x 11x                 1x 73x             1x 20x   20x                                   1x 10x 10x   10x       4x   2x 2x                                         32x                     1x 20x 20x 20x   20x 4x 4x             4x 4x             4x                                             20x                               8x   4x 4x                                                                                 4x 4x                   4x                                         80x                                                                                                                           1x 20x 20x 20x 20x   20x 4x                   20x                                     8x   4x 4x 4x                                                                         80x                                                                                             1x 34x 33x   33x 33x 33x   33x 33x 33x   33x 33x   10x             33x           33x   2x 2x             2x   2x   1x                 1x 1x   1x   2x             33x 14x     33x                                                                                                                                                                                                                       1x 11x 11x 11x 11x 11x   11x                                                                                          
import { init, send } from '@emailjs/browser';
import { yupResolver } from '@hookform/resolvers/yup';
import {
  Business as BusinessIcon,
  CalendarTodayOutlined as CalendarTodayOutlinedIcon,
  Email as EmailIcon,
  Message as MessageIcon,
  Person as PersonIcon,
  PlaceOutlined as PlaceOutlinedIcon,
  Send as SendIcon,
} from '@mui/icons-material';
import {
  Timeline,
  TimelineConnector,
  TimelineContent,
  TimelineDot,
  TimelineItem,
  timelineItemClasses,
  TimelineOppositeContent,
  timelineOppositeContentClasses,
  TimelineSeparator,
} from '@mui/lab';
import {
  Avatar,
  Box,
  Button,
  Container,
  FormControl,
  Grid,
  IconButton,
  InputAdornment,
  LinearProgress,
  Link,
  Skeleton,
  Stack,
  TextField,
  Theme,
  Tooltip,
  Typography,
  useMediaQuery,
  useTheme,
} from '@mui/material';
import { SxProps } from '@mui/system';
import React from 'react';
import { useForm } from 'react-hook-form';
import { TFunction, useTranslation } from 'react-i18next';
import { useInView } from 'react-intersection-observer';
import { toast } from 'react-toastify';
import { InferType } from 'yup';
 
import imageProfile from '@/assets/profile.webp';
import { ConfirmDialog, PrivacyPolicyDialog } from '@/components/dialogs';
import { ChipList, ChipListItem, SectionFadeIn, SectionTitle } from '@/components/elements';
import { meta, sections, styles, values } from '@/constants';
import { CareerData, CertificationData, Sns, useCareers, useCertifications, useSns } from '@/hooks';
import { getApiClient } from '@/lib';
import { PendingContext } from '@/pages';
import { createSchema } from '@/schemas/About';
import { handleError } from '@/utils/errors';
import { LocaleCodes, localeCodes } from '@/utils/localization';
import { extractAltText4ShieldsIo } from '@/utils/strings';
 
const SectionContext = React.createContext(sections.about);
const LocaleContext = React.createContext<{ t: TFunction; code: LocaleCodes }>({ t: () => '', code: localeCodes.jaJp });
 
const ContextProvider = (props: { children: React.ReactNode }) => {
  const [t, i18n] = useTranslation();
  const section = sections.about;
  return (
    <SectionContext.Provider value={section}>
      <LocaleContext.Provider value={{ t: t, code: i18n.language as LocaleCodes }}>
        {props.children}
      </LocaleContext.Provider>
    </SectionContext.Provider>
  );
};
 
const ProfileSectionTitle = (props: { children: React.ReactNode; sx?: SxProps<Theme> }) => (
  <Box sx={{ py: 1, borderBottom: 1, borderColor: 'grey.800', ...props.sx }}>
    <Typography variant="h5" sx={{ ml: 1 }}>
      {props.children}
    </Typography>
  </Box>
);
 
const AuthorArea = () => {
  const locale = React.useContext(LocaleContext);
 
  return (
    <Box sx={{ pb: 4, ml: 1 }}>
      <Typography
        sx={{ display: 'inline-block', lineHeight: 1.3, fontSize: { xs: 32, sm: 36 }, fontWeight: 'bold', mr: 2 }}
        data-testid="About__Author__Name"
      >
        {meta.author}
      </Typography>
      <Typography
        sx={{ display: 'inline-block', lineHeight: 1.3, fontSize: { xs: 20, sm: 22 }, color: 'text.secondary' }}
        data-testid="About__Author__Job"
      >
        {locale.t(`about.author.job`)}
      </Typography>
    </Box>
  );
};
 
const SnsArea = (props: { sns?: Sns[] }) => {
  const section = React.useContext(SectionContext);
  const locale = React.useContext(LocaleContext);
 
  return (
    <>
      {props.sns
        ? props.sns
            .filter((sns) => sns.visible)
            .map((sns, i) => {
              const title = sns[`title_${locale.code}` as keyof typeof sns] as string;
              return (
                <Tooltip key={`${section}__SNS${i}`} title={title} placement="bottom">
                  <IconButton
                    color="inherit"
                    size="large"
                    href={sns.url}
                    target="_blank"
                    sx={{ mx: { xs: 1, sm: 0.5, md: 1 } }}
                    data-testid={`About__SNS${i}`}
                  >
                    <Avatar
                      src={sns.favicon}
                      alt={title}
                      sx={{ width: 36, height: 36 }}
                      data-testid={`About__SNS${i}__Favicon`}
                    />
                  </IconButton>
                </Tooltip>
              );
            })
        : [...Array(values.skeltonCount.about.sns).keys()].map((i) => (
            <Box key={`About__SNS${i}--Loading`} data-testid={`About__SNS${i}--Loading`}>
              <Avatar
                sx={{ width: 36, height: 36, m: { xs: 2, sm: 1, md: 2 } }}
                data-testid={`About__SNS${i}__SkeltonFavicon`}
              />
            </Box>
          ))}
    </>
  );
};
 
const CareerArea = (props: { careers?: CareerData[] }) => {
  const theme = useTheme();
  const ltMd = useMediaQuery(theme.breakpoints.down('md'));
  const locale = React.useContext(LocaleContext);
 
  const AdditionalContent = (p: { career: CareerData; index: number; singleLine: boolean; sx?: SxProps<Theme> }) => {
    const CareerDate = () => (
      <>
        <CalendarTodayOutlinedIcon sx={{ fontSize: 14, mr: 0.5 }} />
        <Typography sx={{ fontSize: 14 }} noWrap data-testid={`About__Career${p.index}__Date`}>
          {p.career.date}
        </Typography>
      </>
    );
    const CareerPlace = () => (
      <>
        <PlaceOutlinedIcon sx={{ fontSize: 16, mr: 0.3 }} />
        <Typography sx={{ fontSize: 14 }} noWrap data-testid={`About__Career${p.index}__Place`}>
          {p.career.place}
        </Typography>
      </>
    );
    return (
      <Box sx={{ ...p.sx }}>
        {p.singleLine ? (
          <Stack direction="row" sx={{ alignItems: 'center', color: 'text.secondary' }}>
            <CareerDate />
            <Box sx={{ ml: 1 }} />
            <CareerPlace />
          </Stack>
        ) : (
          <>
            <Stack direction="row" sx={{ alignItems: 'center', color: 'text.secondary' }}>
              <Box sx={{ ml: 0.1 }} />
              <CareerDate />
            </Stack>
            <Stack direction="row" sx={{ alignItems: 'center', color: 'text.secondary' }}>
              <CareerPlace />
            </Stack>
          </>
        )}
      </Box>
    );
  };
 
  return (
    <>
      <ProfileSectionTitle>CAREER</ProfileSectionTitle>
      <Timeline
        sx={{
          mt: 0,
          pr: 0,
          pl: 2,
          [`& .${timelineOppositeContentClasses.root}`]: {
            pl: 0,
            flex: 0,
          },
        }}
      >
        {props.careers
          ? props.careers
              .filter((career) => career.visible)
              .map((career, i) => {
                const title = career[`title_${locale.code}` as keyof typeof career] as string;
                return (
                  <TimelineItem key={`About__Career${i}`} data-testid={`About__Career${i}`}>
                    <TimelineOppositeContent sx={{ mt: 0.5, pr: 0 }}>
                      {!ltMd && (
                        <Stack width={100}>
                          <AdditionalContent career={career} index={i} singleLine={false} />
                        </Stack>
                      )}
                    </TimelineOppositeContent>
                    <TimelineSeparator>
                      <TimelineDot sx={{ p: 0, bgcolor: 'common.white' }}>
                        {career.favicon ? (
                          <Avatar
                            src={career.favicon}
                            alt={title}
                            sx={{ width: 36, height: 36 }}
                            data-testid={`About__Career${i}__Favicon`}
                          />
                        ) : (
                          <BusinessIcon
                            sx={{ color: 'grey', width: 32, height: 32, m: 0.25 }}
                            data-testid={`About__Career${i}__Favicon`}
                          />
                        )}
                      </TimelineDot>
                      <TimelineConnector />
                    </TimelineSeparator>
                    <TimelineContent sx={{ mt: 0.5, pr: 0, pl: 2 }}>
                      {ltMd && <AdditionalContent career={career} index={i} singleLine={true} sx={{ mb: 0.3 }} />}
                      <Typography sx={{ fontSize: 16 }} data-testid={`About__Career${i}__Name`}>
                        {career.url ? (
                          <Link href={career.url} target="_blank" color="inherit" underline="hover">
                            {title}
                          </Link>
                        ) : (
                          title
                        )}
                      </Typography>
                      {career.details
                        ?.sort((a, b) => a.rowNo - b.rowNo)
                        .map((careerDetail, j) => {
                          const subject = careerDetail[`subject_${locale.code}` as keyof typeof careerDetail] as string;
                          return (
                            <Box key={`About__Career${i}__Body${j}`}>
                              <Typography
                                sx={{ fontSize: 14, color: 'text.secondary' }}
                                data-testid={`About__Career${i}__Body${j}`}
                              >
                                {subject}
                              </Typography>
                              <ChipList sx={{ mt: 1 }}>
                                {careerDetail.skills.map((skill, k) => (
                                  <ChipListItem
                                    key={`About__Career${i}__Body${j}__Skill${k}`}
                                    data-testid={`About__Career${i}__Body${j}__Skill${k}`}
                                  >
                                    <img
                                      src={skill.icon}
                                      alt={extractAltText4ShieldsIo(skill.icon)}
                                      loading="lazy"
                                      decoding="async"
                                    />
                                  </ChipListItem>
                                ))}
                              </ChipList>
                            </Box>
                          );
                        })}
                    </TimelineContent>
                  </TimelineItem>
                );
              })
          : [...Array(values.skeltonCount.about.career).keys()].map((i) => (
              <TimelineItem key={`About__Career${i}--Loading`} data-testid={`About__Career${i}--Loading`}>
                <TimelineOppositeContent sx={{ mt: 0.5, pr: 0 }}>
                  {!ltMd && (
                    <Stack width={100}>
                      <Skeleton
                        data-testid={`About__Career${i}__SkeletonDate`}
                        animation="wave"
                        variant="text"
                        sx={{ height: 20, width: '60%' }}
                      />
                      <Skeleton
                        data-testid={`About__Career${i}__SkeletonPlace`}
                        animation="wave"
                        variant="text"
                        sx={{ height: 20, width: '80%' }}
                      />
                    </Stack>
                  )}
                </TimelineOppositeContent>
                <TimelineSeparator>
                  <TimelineDot sx={{ p: 0, bgcolor: 'common.white' }}>
                    <Avatar sx={{ width: 36, height: 36 }} data-testid={`About__Career${i}__SkeltonFavicon`} />
                  </TimelineDot>
                  <TimelineConnector />
                </TimelineSeparator>
                <TimelineContent sx={{ mt: 0.5, pr: 0, pl: 2 }}>
                  {ltMd && (
                    <Stack direction="row">
                      <Skeleton
                        data-testid={`About__Career${i}__SkeletonDate`}
                        animation="wave"
                        variant="text"
                        sx={{ height: 20, width: '15%' }}
                      />
                      <Skeleton
                        data-testid={`About__Career${i}__SkeletonPlace`}
                        animation="wave"
                        variant="text"
                        sx={{ height: 20, width: '20%', ml: 1 }}
                      />
                    </Stack>
                  )}
                  <Skeleton
                    data-testid={`About__Career${i}__SkeletonName`}
                    animation="wave"
                    variant="text"
                    sx={{ height: 30, width: '80%' }}
                  />
                  <Skeleton
                    data-testid={`About__Career${i}__SkeletonBody`}
                    animation="wave"
                    variant="text"
                    sx={{ height: 20, width: '60%' }}
                  />
                </TimelineContent>
              </TimelineItem>
            ))}
      </Timeline>
    </>
  );
};
 
const CertificationArea = (props: { certifications?: CertificationData[] }) => {
  const theme = useTheme();
  const ltMd = useMediaQuery(theme.breakpoints.down('md'));
  const section = React.useContext(SectionContext);
  const locale = React.useContext(LocaleContext);
 
  const AdditionalContent = (p: { certification: CertificationData; index: number; sx?: SxProps<Theme> }) => {
    return (
      <Stack direction="row" gap={0.5} sx={{ alignItems: 'center', color: 'text.secondary', ...p.sx }}>
        <CalendarTodayOutlinedIcon sx={{ fontSize: 14 }} />
        <Typography sx={{ fontSize: 14 }} noWrap data-testid={`About__Certification${p.index}__Date`}>
          {p.certification.date}
        </Typography>
      </Stack>
    );
  };
 
  return (
    <>
      <ProfileSectionTitle>CERTIFICATION</ProfileSectionTitle>
      <Timeline
        sx={{
          mt: 0,
          pr: 0,
          pl: 2,
          [`& .${timelineOppositeContentClasses.root}`]: {
            pl: 0,
            flex: 0,
          },
          [`& .${timelineItemClasses.root}`]: {
            minHeight: 0,
          },
        }}
      >
        {props.certifications
          ? props.certifications
              .filter((certification) => certification.visible)
              .map((certification, i) => {
                const title = certification[`title_${locale.code}` as keyof typeof certification] as string;
                const subject = certification[`subject_${locale.code}` as keyof typeof certification] as string;
                return (
                  <TimelineItem key={`${section}__Certification${i}`} data-testid={`About__Certification${i}`}>
                    <TimelineOppositeContent sx={{ mt: 1.8, pr: 0 }}>
                      {!ltMd && (
                        <Stack width={100}>
                          <AdditionalContent certification={certification} index={i} sx={{ ml: 0.1 }} />
                        </Stack>
                      )}
                    </TimelineOppositeContent>
                    <TimelineSeparator>
                      <TimelineDot sx={{ mb: 0, p: 0, bgcolor: 'common.white' }}>
                        <Avatar
                          src={certification.favicon}
                          alt={title}
                          sx={{ width: 36, height: 36 }}
                          data-testid={`About__Certification${i}__Favicon`}
                        />
                      </TimelineDot>
                    </TimelineSeparator>
                    <TimelineContent sx={{ mb: { xs: 1, md: 0 }, mt: 0.5, pr: 0, pl: 2 }}>
                      {ltMd && <AdditionalContent certification={certification} index={i} sx={{ mt: -1.5, mb: 0.3 }} />}
                      <Typography sx={{ fontSize: 16 }} data-testid={`About__Certification${i}__Name`}>
                        <Link href={certification.url} target="_blank" color="inherit" underline="hover">
                          {title}
                        </Link>
                      </Typography>
                      <Typography
                        sx={{ fontSize: 14, color: 'text.secondary' }}
                        data-testid={`About__Certification${i}__Body`}
                      >
                        {subject}
                      </Typography>
                    </TimelineContent>
                  </TimelineItem>
                );
              })
          : [...Array(values.skeltonCount.about.certification).keys()].map((i) => (
              <TimelineItem key={`About__Certification${i}--Loading`} data-testid={`About__Certification${i}--Loading`}>
                <TimelineOppositeContent sx={{ mt: 1.8, pr: 0 }}>
                  {!ltMd && (
                    <Stack width={100}>
                      <Skeleton
                        data-testid={`About__Certification${i}__SkeletonDate`}
                        animation="wave"
                        variant="text"
                        sx={{ height: 20, width: '60%' }}
                      />
                    </Stack>
                  )}
                </TimelineOppositeContent>
                <TimelineSeparator>
                  <TimelineDot sx={{ mb: 0, p: 0, bgcolor: 'common.white' }}>
                    <Avatar sx={{ width: 36, height: 36 }} data-testid={`About__Certification${i}__SkeltonFavicon`} />
                  </TimelineDot>
                </TimelineSeparator>
                <TimelineContent sx={{ mb: { xs: 1, md: 0 }, mt: 0.5, pr: 0, pl: 2 }}>
                  {ltMd && (
                    <Skeleton
                      data-testid={`About__Certification${i}__SkeletonDate`}
                      animation="wave"
                      variant="text"
                      sx={{ height: 20, width: '15%', mt: -1.5 }}
                    />
                  )}
                  <Skeleton
                    data-testid={`About__Certification${i}__SkeletonName`}
                    animation="wave"
                    variant="text"
                    sx={{ height: 30, width: '50%' }}
                  />
                  <Skeleton
                    data-testid={`About__Certification${i}__SkeletonBody`}
                    animation="wave"
                    variant="text"
                    sx={{ height: 20, width: '30%' }}
                  />
                </TimelineContent>
              </TimelineItem>
            ))}
      </Timeline>
    </>
  );
};
 
const ContactArea = () => {
  const [, setIsPending] = React.useContext(PendingContext);
  const locale = React.useContext(LocaleContext);
 
  const [confirmOpened, setConfirmOpened] = React.useState(false);
  const confirmInquiry = React.useCallback(() => setConfirmOpened(true), []);
  const confirmInquiryCanceled = React.useCallback(() => setConfirmOpened(false), []);
 
  const [privacyPolicyOpened, setPrivacyPolicyOpened] = React.useState(false);
  const openPrivacyPolicy = React.useCallback(() => setPrivacyPolicyOpened(true), []);
  const closePrivacyPolicy = React.useCallback(() => setPrivacyPolicyOpened(false), []);
 
  const schema = createSchema();
  const defaultValues = React.useMemo(
    () =>
      ({
        name: '',
        email: '',
        inquiry: '',
      } as InferType<typeof schema>),
    []
  );
  const formMethod = useForm({
    mode: 'all',
    defaultValues: defaultValues,
    resolver: yupResolver(schema),
  });
 
  const submit = React.useCallback(
    async (data: InferType<typeof schema>) => {
      try {
        const params = {
          name: data.name,
          email: data.email,
          message: data.inquiry,
        };
 
        /* istanbul ignore else */
        if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test') {
          /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
          init(process.env.REACT_APP_EMAILJS_USER_ID!);
          /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
          await send(process.env.REACT_APP_EMAILJS_SERVICE_ID!, process.env.REACT_APP_EMAILJS_TEMPLATE_ID!, params);
        } else {
          const client = getApiClient();
          const response = await client.get(`${process.env.REACT_APP_GOOGLEAPIS_URL}/dev/csrf-token`);
          await client.post(`${process.env.REACT_APP_GOOGLEAPIS_URL}/dev/send`, params, {
            headers: { 'x-csrf-token': response.data.data },
          });
        }
 
        toast.success(locale.t('about.contact.send', { context: 'succeeded' }));
        formMethod.reset();
      } catch (e) {
        handleError(e);
      } finally {
        setConfirmOpened(false);
      }
    },
    [formMethod, locale]
  );
 
  // React Hook Form の isSubmitting を Context に伝播させる
  React.useEffect(() => {
    setIsPending(formMethod.formState.isSubmitting);
  }, [setIsPending, formMethod.formState.isSubmitting]);
 
  return (
    <>
      <ConfirmDialog
        open={confirmOpened}
        title={locale.t('about.contact.send', { context: 'confirm' })}
        message={formMethod.getValues('inquiry')}
        affirmativeAction={formMethod.handleSubmit(submit)}
        negativeAction={confirmInquiryCanceled}
        bottomContent={formMethod.formState.isSubmitting && <LinearProgress color="inherit" />}
      />
 
      <PrivacyPolicyDialog open={privacyPolicyOpened} closeAction={closePrivacyPolicy} />
 
      <ProfileSectionTitle>CONTACT</ProfileSectionTitle>
      <Box sx={{ px: 1, py: 2 }}>
        <FormControl fullWidth margin="dense">
          <TextField
            {...formMethod.register('name')}
            error={!!formMethod.formState.errors.name}
            helperText={formMethod.formState.errors.name?.message}
            label={locale.t('about.contact.name')}
            color="info"
            variant="outlined"
            InputProps={{
              startAdornment: (
                <InputAdornment position="start">
                  <PersonIcon />
                </InputAdornment>
              ),
            }}
            // HACK: MUI の TextField は内部の input に data-testid を付与する必要がある
            inputProps={{ 'data-testid': 'About__Contact__Name' }}
          />
        </FormControl>
        <FormControl fullWidth margin="dense">
          <TextField
            {...formMethod.register('email')}
            error={!!formMethod.formState.errors.email}
            helperText={formMethod.formState.errors.email?.message}
            label={locale.t('about.contact.email')}
            color="info"
            variant="outlined"
            InputProps={{
              startAdornment: (
                <InputAdornment position="start">
                  <EmailIcon />
                </InputAdornment>
              ),
            }}
            inputProps={{ 'data-testid': 'About__Contact__Email' }}
          />
        </FormControl>
        <FormControl fullWidth margin="dense">
          <TextField
            {...formMethod.register('inquiry')}
            error={!!formMethod.formState.errors.inquiry}
            helperText={formMethod.formState.errors.inquiry?.message}
            label={locale.t('about.contact.message')}
            color="info"
            variant="outlined"
            multiline
            minRows={3}
            maxRows={10}
            InputProps={{
              startAdornment: (
                <InputAdornment position="start">
                  <MessageIcon />
                </InputAdornment>
              ),
            }}
            inputProps={{ 'data-testid': 'About__Contact__Message' }}
          />
        </FormControl>
        <FormControl fullWidth margin="dense">
          <Button
            color="info"
            variant="outlined"
            startIcon={<SendIcon />}
            sx={{ mt: 1 }}
            disabled={!formMethod.formState.isValid || formMethod.formState.isSubmitting}
            onClick={confirmInquiry}
            data-testid="About__Contact__Send"
          >
            {locale.t('about.contact.send')}
          </Button>
        </FormControl>
 
        <Typography sx={{ color: 'grey.600', fontSize: 12, mt: 1 }} data-testid="About__Contact__Attention">
          {locale.t('about.contact.attention')}
        </Typography>
 
        <Box sx={{ mt: 2, textAlign: 'center' }}>
          <Link
            component="button"
            type="button"
            variant="caption"
            color="text.secondary"
            onClick={openPrivacyPolicy}
            data-testid="About__Contact__PrivacyPolicy"
          >
            {locale.t('about.contact.privacyPolicy')}
          </Link>
        </Box>
      </Box>
    </>
  );
};
 
export const About = (props: { sx?: SxProps<Theme> }) => {
  const { ref, inView } = useInView(styles.intersectionOptions);
  const careers = useCareers(inView);
  const certifications = useCertifications(inView);
  const sns = useSns(inView);
  const section = sections.about;
 
  return (
    <Box component="section" id={section} sx={{ py: 8, ...props.sx }}>
      <Container>
        <SectionTitle data-testid="About__SectionTitle">{section}</SectionTitle>
 
        <Box ref={ref}>
          <SectionFadeIn in={inView}>
            <Grid container spacing={4} mt={2}>
              <ContextProvider>
                <Grid item xs={12} sm={4} order={{ xs: 0, sm: 1 }}>
                  <Avatar
                    src={imageProfile}
                    alt="profile image"
                    variant="rounded"
                    sx={{ width: 'auto', height: 'auto', mx: { xs: 4, sm: 0 } }}
                  />
 
                  <Box sx={{ mt: 2, display: 'flex', justifyContent: 'center' }}>
                    <SnsArea sns={sns} />
                  </Box>
 
                  <Box sx={{ mt: 2, display: { xs: 'block', sm: 'none' } }}>
                    <AuthorArea />
                    <CareerArea careers={careers} />
                    <CertificationArea certifications={certifications} />
                  </Box>
 
                  <Box sx={{ mt: { xs: 0.5, sm: 3 } }}>
                    <ContactArea />
                  </Box>
                </Grid>
 
                <Grid item xs={12} sm={8} order={{ xs: 1, sm: 0 }} sx={{ display: { xs: 'none', sm: 'block' } }}>
                  <AuthorArea />
                  <CareerArea careers={careers} />
                  <CertificationArea certifications={certifications} />
                </Grid>
              </ContextProvider>
            </Grid>
          </SectionFadeIn>
        </Box>
      </Container>
    </Box>
  );
};