-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathAddBar.tsx
More file actions
30 lines (27 loc) · 787 Bytes
/
AddBar.tsx
File metadata and controls
30 lines (27 loc) · 787 Bytes
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
import { Icon } from 'idea-react';
import { FC } from 'react';
import { Button } from 'react-bootstrap';
const type_map = {
string: { title: 'Inline text', icon: 'input-cursor' },
text: { title: 'Rows text', icon: 'text-left' },
object: { title: 'Key-value list', icon: 'list-ul' },
array: { title: 'Ordered list', icon: 'list-ol' },
};
export interface AddBarProps {
onSelect: (type: string) => void;
}
export const AddBar: FC<AddBarProps> = ({ onSelect }) => (
<nav className="d-flex gap-1">
{Object.entries(type_map).map(([key, { title, icon }]) => (
<Button
key={key}
size="sm"
variant="success"
title={title}
onClick={onSelect.bind(null, key)}
>
<Icon name={icon} />
</Button>
))}
</nav>
);