This repository was archived by the owner on Jan 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaward-footer.tsx
More file actions
128 lines (115 loc) · 2.99 KB
/
award-footer.tsx
File metadata and controls
128 lines (115 loc) · 2.99 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
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
import styled from 'styled-components'
import { Container, FlexBox, Text } from '@titicaca/core-elements'
import { Fragment, useState } from 'react'
import { LinkGroup as LinkGroupBase } from './link-group'
import {
DefaultFooterProps as AwardFooterProps,
FooterFrame,
} from './default-footer'
import { CompanyInfo } from './company-info'
import { ExtraLinkGroup } from './extra-link-group'
import { useFooterInfo } from './use-footer-info'
import { FooterAward } from './type'
import { AWARD_FOOTER_MIN_HEIGHT } from './constants'
const InfoFlexBox = styled(FlexBox).attrs({
flex: true,
justifyContent: 'space-between',
alignItems: 'flex-end',
})`
> div {
line-height: inherit;
}
`
const AwardImg = styled.img`
width: 26px;
height: 28px;
`
const Tooltip = styled.div`
display: none;
position: absolute;
bottom: calc(100% + 4px);
right: 0;
border: 1px solid var(--color-brightGray);
border-radius: 6px;
padding: 8px 11px;
background-color: var(--color-white);
font-size: 10px;
font-weight: 500;
color: var(--color-gray800);
line-height: 14px;
white-space: pre;
`
const AwardFlexBox = styled(FlexBox).attrs({
position: 'relative',
flex: true,
gap: 7,
flexShrink: 0,
})`
${AwardImg}:hover + ${Tooltip} {
display: block;
}
`
export function AwardFooter({
hideAppDownloadButton = false,
...props
}: AwardFooterProps) {
const footerInfo = useFooterInfo()
const [businessExpanded, setBusinessExpanded] = useState<boolean>(false)
if (!footerInfo) {
return (
<FooterFrame
{...props}
css={{ minHeight: AWARD_FOOTER_MIN_HEIGHT, width: '100%' }}
/>
)
}
return (
<FooterFrame {...props}>
<Container
centered
css={{
minWidth: 280,
maxWidth: 768,
padding: '30px 30px 40px',
}}
>
<CompanyInfo
companyTexts={footerInfo.companyTexts}
hideAppDownloadButton={hideAppDownloadButton}
businessExpanded={businessExpanded}
setBusinessExpanded={setBusinessExpanded}
buttons={footerInfo.buttons}
/>
<Text
size={11}
lineHeight="17px"
color="gray500"
margin={{ top: businessExpanded ? 15 : 20, bottom: 5 }}
css={{ wordBreak: 'break-word' }}
>
{footerInfo.disclaimer}
</Text>
<InfoFlexBox>
<Container>
<LinkGroupBase links={footerInfo.links} />
<ExtraLinkGroup extraLinks={footerInfo.extraLinks} />
</Container>
<AwardGroup awards={footerInfo.awards} />
</InfoFlexBox>
</Container>
</FooterFrame>
)
}
function AwardGroup({ awards }: { awards: FooterAward[] }) {
return (
<AwardFlexBox>
{awards.map(({ imageUrl, alt, text }, index) => (
<Fragment key={`award-${index}`}>
<AwardImg src={imageUrl} alt={alt} />
<Tooltip>{text}</Tooltip>
</Fragment>
))}
</AwardFlexBox>
)
}
export default AwardFooter