-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathPolicies.tsx
More file actions
87 lines (75 loc) · 2.24 KB
/
Policies.tsx
File metadata and controls
87 lines (75 loc) · 2.24 KB
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
import React from "react";
import styled from "styled-components";
import PaperclipIcon from "svgs/icons/paperclip.svg";
import PolicyIcon from "svgs/icons/policy.svg";
import { getIpfsUrl } from "utils/getIpfsUrl";
import { isUndefined } from "utils/index";
import { responsiveSize } from "styles/responsiveSize";
import { hoverShortTransitionTiming } from "styles/commonStyles";
import { InternalLink } from "components/InternalLink";
const Container = styled.div`
display: flex;
align-items: center;
flex-direction: row;
flex-wrap: wrap;
gap: 8px 16px;
padding: ${responsiveSize(16, 20)} ${responsiveSize(16, 32)};
background-color: ${({ theme }) => theme.mediumBlue};
`;
const StyledP = styled.p`
font-size: 14px;
margin: 0;
color: ${({ theme }) => theme.primaryBlue};
`;
const StyledPolicyIcon = styled(PolicyIcon)`
width: 16px;
fill: ${({ theme }) => theme.primaryBlue};
`;
const StyledPaperclipIcon = styled(PaperclipIcon)`
width: 16px;
fill: ${({ theme }) => theme.primaryBlue};
`;
const StyledInternalLink = styled(InternalLink)`
${hoverShortTransitionTiming}
display: flex;
gap: 4px;
&:hover {
svg {
fill: ${({ theme }) => theme.secondaryBlue};
}
}
`;
type Attachment = {
label?: string;
uri: string;
};
interface IPolicies {
disputePolicyURI?: string;
courtId?: string;
attachment?: Attachment;
}
export const Policies: React.FC<IPolicies> = ({ disputePolicyURI, courtId, attachment }) => {
return (
<Container>
<StyledP>Policy documents:</StyledP>
{!isUndefined(attachment) && !isUndefined(attachment.uri) ? (
<StyledInternalLink to={`attachment/?url=${getIpfsUrl(attachment.uri)}`}>
<StyledPaperclipIcon />
{attachment.label ?? "Attachment"}
</StyledInternalLink>
) : null}
{isUndefined(disputePolicyURI) ? null : (
<StyledInternalLink to={`policy/attachment/?url=${getIpfsUrl(disputePolicyURI)}`}>
<StyledPolicyIcon />
Dispute Policy
</StyledInternalLink>
)}
{isUndefined(courtId) ? null : (
<StyledInternalLink to={`/courts/${courtId}/policy?section=description`}>
<StyledPolicyIcon />
Court Policy
</StyledInternalLink>
)}
</Container>
);
};