Passed
Push — task/common-translation-packag... ( dbb970...52324d )
by Tristan
06:50 queued 11s
created

resources/assets/js/components/UnclaimedJobCard.tsx   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 130
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 107
mnd 1
bc 1
fnc 0
dl 0
loc 130
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import React from "react";
2
import { FormattedMessage, useIntl } from "react-intl";
3
import { JobStatus } from "../models/lookupConstants";
4
import { jobStatus } from "../models/localizedConstants";
5
import { Link } from "../models/app";
6
7
export interface UnclaimedJobCardProps {
8
  id: number;
9
  jobLink: Link;
10
  createdAt: string;
11
  status: JobStatus;
12
  hiringManager: string;
13
  hrAdvisors: string[];
14
  handleClaimJob: () => void;
15
}
16
17
const UnclaimedJobCard: React.FunctionComponent<UnclaimedJobCardProps> = ({
18
  jobLink,
19
  createdAt,
20
  status,
21
  hiringManager,
22
  hrAdvisors,
23
  handleClaimJob,
24
}) => {
25
  const intl = useIntl();
26
  return (
27
    <div
28
      data-c-grid-item="tp(1of2) tl(1of3) equal-col"
29
      className="tc-hr-job-card"
30
    >
31
      <div data-c-card data-c-radius="rounded" data-c-background="white(100)">
32
        <a
33
          href={jobLink.url}
34
          title={jobLink.title}
35
          style={{ textDecoration: "none" }}
36
        >
37
          <div data-c-background="black(100)" data-c-padding="all(normal)">
38
            <div data-c-grid="gutter middle">
39
              <div data-c-grid-item="base(1of1)">
40
                <p
41
                  data-c-font-size="h4"
42
                  data-c-colour="white"
43
                  data-c-font-style="underline"
44
                >
45
                  {jobLink.text}
46
                </p>
47
              </div>
48
              <div data-c-grid-item="base(1of2)">
49
                <p data-c-colour="white" data-c-font-size="small">
50
                  <FormattedMessage
51
                    id="openJobCard.createdAt"
52
                    description="Header for when Job Poster was created."
53
                    defaultMessage="Created: "
54
                  />
55
                  {createdAt}
56
                </p>
57
              </div>
58
              <div data-c-grid-item="base(1of2)" data-c-align="base(right)">
59
                <span
60
                  data-c-color="white"
61
                  data-c-border="all(thin, solid, white)"
62
                  data-c-padding="tb(quarter) rl(half)"
63
                  data-c-font-size="small"
64
                  data-c-radius="pill"
65
                >
66
                  {intl.formatMessage(jobStatus(status))}
67
                </span>
68
              </div>
69
            </div>
70
          </div>
71
          <div data-c-padding="all(normal)">
72
            <p data-c-color="black" data-c-margin="bottom(normal)">
73
              <FormattedMessage
74
                id="openJobCard.hiringManager"
75
                description="Header before list of hiring managers."
76
                defaultMessage="Hiring Managers: "
77
              />
78
              {hiringManager}
79
            </p>
80
81
            {hrAdvisors.length > 0 ? (
82
              <p data-c-color="black" data-c-margin="bottom(normal)">
83
                <FormattedMessage
84
                  id="openJobCard.hrAdvisors"
85
                  description="Header before list of HR advisors."
86
                  defaultMessage="HR Advisors: "
87
                />
88
                {hrAdvisors.join(", ")}
89
              </p>
90
            ) : (
91
              <p data-c-color="stop" data-c-margin="bottom(normal)">
92
                <FormattedMessage
93
                  id="openJobCard.unclaimed"
94
                  description="Message displayed if not HR managers have claimed a job."
95
                  defaultMessage="Unclaimed"
96
                />
97
              </p>
98
            )}
99
          </div>
100
        </a>
101
        <div
102
          data-c-padding="all(normal)"
103
          data-c-border="top(thin, solid, black)"
104
          data-c-align="base(right)"
105
        >
106
          <button
107
            data-c-button="solid(c2)"
108
            data-c-radius="rounded"
109
            type="button"
110
            onClick={handleClaimJob}
111
          >
112
            <span>
113
              +{" "}
114
              <span data-c-font-style="underline">
115
                <FormattedMessage
116
                  id="openJobCard.claimJob"
117
                  description="Message indicating the event of clicking on the job card."
118
                  defaultMessage="Claim This Job"
119
                />
120
              </span>
121
            </span>
122
          </button>
123
        </div>
124
      </div>
125
    </div>
126
  );
127
};
128
129
export default UnclaimedJobCard;
130