Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/resources/scripts/components/elements/PageContentBlock.tsx
7461 views
1
import React, { useEffect } from 'react';
2
import ContentContainer from '@/components/elements/ContentContainer';
3
import { CSSTransition } from 'react-transition-group';
4
import tw from 'twin.macro';
5
import FlashMessageRender from '@/components/FlashMessageRender';
6
7
export interface PageContentBlockProps {
8
title?: string;
9
className?: string;
10
showFlashKey?: string;
11
}
12
13
const PageContentBlock: React.FC<PageContentBlockProps> = ({ title, showFlashKey, className, children }) => {
14
useEffect(() => {
15
if (title) {
16
document.title = title;
17
}
18
}, [title]);
19
20
return (
21
<CSSTransition timeout={150} classNames={'fade'} appear in>
22
<>
23
<ContentContainer css={tw`my-4 sm:my-10`} className={className}>
24
{showFlashKey && <FlashMessageRender byKey={showFlashKey} css={tw`mb-4`} />}
25
{children}
26
</ContentContainer>
27
<ContentContainer css={tw`mb-4`}>
28
<p css={tw`text-center text-neutral-500 text-xs`}>
29
<a
30
rel={'noopener nofollow noreferrer'}
31
href={'https://pterodactyl.io'}
32
target={'_blank'}
33
css={tw`no-underline text-neutral-500 hover:text-neutral-300`}
34
>
35
Pterodactyl&reg;
36
</a>
37
&nbsp;&copy; 2015 - {new Date().getFullYear()}
38
</p>
39
</ContentContainer>
40
</>
41
</CSSTransition>
42
);
43
};
44
45
export default PageContentBlock;
46
47