Skip to content
This repository was archived by the owner on Aug 18, 2023. It is now read-only.

Commit e322203

Browse files
nalesnichokRomanHotsiy
authored andcommitted
chore: add custom overrides examples
1 parent 3d1253b commit e322203

10 files changed

+907
-18
lines changed

_override/App.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as React from 'react';
2+
import type { Location } from 'history';
3+
4+
/**
5+
* Root wrapper.
6+
*/
7+
export function App({ children, location }: React.PropsWithChildren<{ location: Location }>) {
8+
return (
9+
<>
10+
{/* you can add some top-level providers here or anything to wrap whole app */}
11+
12+
{/* <header style={{background: 'yellow', textAlign: 'center', padding: '20px 0', fontSize: '24px'}}>
13+
Header
14+
</header> */}
15+
16+
{children}
17+
</>
18+
);
19+
}

_override/Footer.tsx

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
import * as React from 'react';
2+
import styled from 'styled-components';
3+
4+
import { Box, Flex, Link, FooterProps } from '@redocly/developer-portal/ui';
5+
6+
/**
7+
* Custom Navbar. The implementation below is almost identical to our default Footer
8+
*/
9+
export default function CustomFooter(props: FooterProps) {
10+
// you can use columns/copyright values from props, it comes from siteConfig.yaml
11+
// but you can also import it from a separate yaml or json file
12+
const { columns, copyrightText } = props.footer;
13+
const siteVersion = props.siteVersion;
14+
15+
const columnsElement = columns.length ? (
16+
<FooterColumns
17+
justifyContent="center"
18+
flexWrap="wrap"
19+
flex="1"
20+
p={{ xs: '3em 0 1em 0', small: '5.625em 0 3.9375em 0' }}
21+
>
22+
<Flex
23+
justifyContent="center"
24+
flexDirection={{ xs: 'column', small: 'row' }}
25+
flexWrap={{ small: 'wrap' }}
26+
maxWidth={'1200px'}
27+
flex={{ small: '1 1 100%' }}
28+
px={'20px'}
29+
>
30+
{columns.map((column, index) => (
31+
<Box
32+
key={index}
33+
textAlign={{ xs: 'center', small: 'left' }}
34+
mb={{ xs: '4em', small: '3em', medium: 0 }}
35+
flex={{ xs: '0 calc(50% - 20px)', small: '0 calc(33.333% - 20px)', medium: 1 }}
36+
mx={10}
37+
>
38+
<ColumnTitle>{column.group || column.label}</ColumnTitle>
39+
<ColumnList>
40+
{column.items.map((columnItem, columnItemInex) =>
41+
columnItem.type === 'separator' ? (
42+
<FooterSeparator key={columnItem.label + '_' + columnItemInex}>{columnItem.label}</FooterSeparator>
43+
) : (
44+
<ColumnListItem key={columnItemInex}>
45+
<Link to={columnItem.link} target={columnItem.target} external={columnItem.external}>
46+
{columnItem.label}
47+
</Link>
48+
</ColumnListItem>
49+
)
50+
)}
51+
</ColumnList>
52+
</Box>
53+
))}
54+
</Flex>
55+
</FooterColumns>
56+
) : null;
57+
58+
const infoElement =
59+
copyrightText || siteVersion ? (
60+
<FooterInfo>
61+
<FooterCopyright>
62+
{copyrightText} {siteVersion ? `| ${siteVersion}` : null}
63+
</FooterCopyright>
64+
</FooterInfo>
65+
) : null;
66+
67+
return (
68+
<FooterWrapper>
69+
{columnsElement}
70+
{infoElement}
71+
</FooterWrapper>
72+
);
73+
}
74+
75+
const FooterColumns = styled(Flex)`
76+
background-color: ${({ theme }) => theme.colors.footer.main};
77+
color: ${({ theme }) => theme.colors.footer.contrastText};
78+
font-family: ${({ theme }) => theme.typography.headings.fontFamily};
79+
80+
a,
81+
a:hover {
82+
color: ${({ theme }) => theme.colors.footer.contrastText};
83+
}
84+
`;
85+
86+
// very important for NavWrapper to be a "footer" HTML tag
87+
const FooterWrapper = styled.footer`
88+
font-size: 1rem;
89+
flex-shrink: 0;
90+
font-family: ${({ theme }) => theme.typography.fontFamily};
91+
92+
@media print {
93+
color: black;
94+
${FooterColumns} {
95+
display: none;
96+
}
97+
}
98+
`;
99+
100+
export const FooterInfo = styled.section`
101+
display: flex;
102+
justify-content: center;
103+
font-size: 0.875em;
104+
padding: 1.5em 3em;
105+
font-weight: ${({ theme }) => theme.typography.fontWeightBold};
106+
background-color: ${({ theme }) => theme.colors.footer.main};
107+
color: ${({ theme }) => theme.colors.footer.contrastText};
108+
span {
109+
max-width: 1200px;
110+
}
111+
`;
112+
113+
export const ColumnList = styled.ul`
114+
margin: 0;
115+
padding: 0;
116+
list-style: none;
117+
`;
118+
119+
export const ColumnListItem = styled.li`
120+
font-weight: ${({ theme }) => theme.typography.fontWeightBold};
121+
padding-bottom: 0.75em;
122+
a {
123+
color: ${props => props.theme.colors.primary.contrastText};
124+
text-decoration: none;
125+
}
126+
`;
127+
128+
export const FooterSeparator = styled.li`
129+
opacity: 0.75;
130+
margin: 10px 0 5px 0;
131+
font-size: 0.75em;
132+
text-transform: uppercase;
133+
font-family: ${({ theme }) => theme.typography.headings.fontFamily};
134+
`;
135+
136+
export const FooterCopyright = styled.span`
137+
text-align: center;
138+
`;
139+
140+
export const ColumnTitle = styled.span`
141+
display: inline-block;
142+
font-weight: ${({ theme }) => theme.typography.fontWeightRegular};
143+
margin-bottom: 1.5em;
144+
fontfamily: ${({ theme }) => theme.typography.headings.fontFamily};
145+
146+
@media only screen and (min-width: ${({ theme }) => theme.breakpoints.large}) {
147+
margin-bottom: 2.5em;
148+
}
149+
`;

0 commit comments

Comments
 (0)