-
Notifications
You must be signed in to change notification settings - Fork 9
/
header.tsx
61 lines (57 loc) · 1.46 KB
/
header.tsx
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
import React from 'react';
import Checkbox from '@akashaorg/design-system-core/lib/components/Checkbox';
import Stack from '@akashaorg/design-system-core/lib/components/Stack';
import Text from '@akashaorg/design-system-core/lib/components/Text';
import { EditorUIState } from './types';
export interface HeaderProps {
uiState: EditorUIState;
addTagsLabel?: string;
addBlockLabel?: string;
beamEditorLabel?: string;
checkboxIsSelected: boolean;
checkboxIsDisabled: boolean;
onSelectCheckbox: () => void;
}
export const Header: React.FC<HeaderProps> = props => {
const {
uiState,
addTagsLabel,
addBlockLabel,
beamEditorLabel,
checkboxIsSelected,
checkboxIsDisabled,
onSelectCheckbox,
} = props;
const renderTitle = () => {
switch (uiState) {
case 'blocks':
return addBlockLabel;
case 'tags':
return addTagsLabel;
default:
return beamEditorLabel;
}
};
return (
<Stack
padding={16}
justify={uiState === 'editor' ? 'between' : 'center'}
direction="row"
align="center"
customStyle="rounded-t-2xl"
>
<Text variant="h4">{renderTitle()}</Text>
{uiState === 'editor' && (
<Checkbox
id="nsfw"
label="NSFW"
name="nsfw"
value="nsfw"
handleChange={onSelectCheckbox}
isSelected={checkboxIsSelected}
isDisabled={checkboxIsDisabled}
/>
)}
</Stack>
);
};