-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathindex.tsx
More file actions
117 lines (108 loc) · 2.96 KB
/
index.tsx
File metadata and controls
117 lines (108 loc) · 2.96 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
/* eslint-disable react/prop-types */
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { FC } from 'react';
import React from 'react';
import Layout from '@theme/Layout';
import BlogSidebar from '@theme/BlogSidebar';
import {
LinkedinIcon,
LinkedinShareButton,
RedditIcon,
RedditShareButton,
TwitterIcon,
TwitterShareButton,
} from 'react-share';
import useWindowType from '@theme/hooks/useWindowSize';
import type { Props } from '@theme/BlogLayout';
import Link from '@docusaurus/Link';
import Sticky from 'react-stickynode';
import clsx from 'clsx';
import style from './style.module.scss';
export const Share = ({ metadata }) => {
const { title, description, permalink } = metadata;
const url = `https://apisix.apache.org${permalink}`;
return (
<section className={style.shareSection}>
<div>
<LinkedinShareButton title={title} summary={description} url={url}>
<LinkedinIcon size={32} round />
</LinkedinShareButton>
<TwitterShareButton url={url} title={title} via="ApacheAPISIX">
<TwitterIcon size={32} round />
</TwitterShareButton>
<RedditShareButton title={title} url={url}>
<RedditIcon size={32} round />
</RedditShareButton>
</div>
</section>
);
};
const tags = [
{
label: 'Case Studies',
url: '/blog/tags/case-studies/',
},
{
label: 'Ecosystem',
url: '/blog/tags/ecosystem/',
},
{
label: 'Authentication',
url: '/blog/tags/authentication/',
},
{
label: 'Plugins',
url: '/blog/tags/plugins/',
},
{
label: 'Community',
url: '/blog/tags/community/',
},
{
label: 'Vulnerabilities',
url: '/blog/tags/vulnerabilities/',
},
];
const TagsHeader: FC = () => {
const windowType = useWindowType();
return (
<Sticky innerZ={199} className={style.placeholder} enabled={windowType !== 'mobile'}>
{(s) => (
<div className={clsx(style.tagsHeader, s.status === Sticky.STATUS_FIXED && style.expand)}>
{tags.map((tag) => (
<Link key={tag.url} to={tag.url} target="_parent">
{tag.label}
</Link>
))}
</div>
)}
</Sticky>
);
};
const BlogLayout: FC<Props> = (props) => {
const {
sidebar, toc, children, metadata, ...layoutProps
} = props;
const hasSidebar = sidebar && sidebar.items.length > 0;
return (
<Layout {...layoutProps}>
<TagsHeader />
<div className="container margin-vert--lg">
<div className="row" style={{ justifyContent: 'center' }}>
{hasSidebar && (
<aside className="col col--3">
<BlogSidebar sidebar={sidebar!} />
</aside>
)}
<div className={clsx({ col: true, 'col--10': toc })}>{children}</div>
</div>
</div>
</Layout>
);
};
export default BlogLayout;