-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathShortcuts.js
More file actions
38 lines (34 loc) · 1.07 KB
/
Shortcuts.js
File metadata and controls
38 lines (34 loc) · 1.07 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
import React from 'react';
import { Link } from 'gatsby';
import { useIntl } from 'react-intl';
import classnames from 'classnames';
import { slugify, toIntlId } from '../utils';
import * as css from './Shortcuts.module.css';
import * as grid from '../styles/grid.module.css';
const Shortcuts = ({ categories }) => {
const intl = useIntl();
return (
<div className={classnames(grid.col, grid.grid, css.root)}>
<h4 className={classnames(grid.col, css.heading)}>
{intl.formatMessage({
id: `Shortcuts`
})}
</h4>
<ul className={classnames(grid.col, grid.grid, css.list)}>
{categories.map((category, key) => (
<li
className={classnames(grid.col, css.item)}
key={`category-navitem-${key}`}>
<div className={css.line} />
<Link className={css.itemLink} to={`#${slugify(category)}`}>
{intl.formatMessage({
id: toIntlId(category)
})}
</Link>
</li>
))}
</ul>
</div>
);
};
export default Shortcuts;