tycho-components 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppLoading/AppLoading.d.ts +2 -1
- package/dist/AppLoading/AppLoading.js +4 -2
- package/dist/AppLoading/style.scss +4 -0
- package/dist/Header/HeaderApps/HeaderApps.js +3 -7
- package/dist/Header/HeaderApps/HeaderAppsDesktop.d.ts +6 -0
- package/dist/Header/HeaderApps/HeaderAppsDesktop.js +29 -0
- package/dist/Header/HeaderCorpora/HeaderCorpora.js +3 -2
- package/dist/Header/HeaderCorpora/HeaderCorpus.d.ts +6 -0
- package/dist/Header/HeaderCorpora/HeaderCorpus.js +8 -0
- package/dist/Header/HeaderCorpora/style.scss +14 -18
- package/dist/Header/HeaderDesktop.d.ts +11 -0
- package/dist/Header/HeaderDesktop.js +21 -0
- package/dist/Header/styles.scss +1 -0
- package/dist/Header/types/App.d.ts +1 -1
- package/dist/Header/types/App.js +32 -10
- package/dist/LanguageSelector/LanguageSelector.d.ts +0 -1
- package/dist/LanguageSelector/LanguageSelector.js +1 -7
- package/dist/LanguageSelector/styles.scss +1 -20
- package/dist/configs/Localization.d.ts +150 -131
- package/dist/configs/Localization.js +9 -5
- package/dist/configs/localization/CommonTexts.d.ts +130 -121
- package/dist/configs/localization/CommonTexts.js +130 -121
- package/dist/configs/localization/HeaderAppTexts.d.ts +98 -0
- package/dist/configs/localization/HeaderAppTexts.js +98 -0
- package/dist/configs/localization/HeaderTexts.d.ts +3 -89
- package/dist/configs/localization/HeaderTexts.js +3 -89
- package/dist/functions/UsabilityUtils.d.ts +0 -1
- package/dist/functions/UsabilityUtils.js +6 -8
- package/package.json +2 -2
- package/dist/LanguageSelector/flags/br.svg +0 -45
- package/dist/LanguageSelector/flags/it.svg +0 -7
- package/dist/LanguageSelector/flags/us.svg +0 -9
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './style.scss';
|
|
2
2
|
type Props = {
|
|
3
3
|
className?: string;
|
|
4
|
+
pageLoading?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export default function AppLoading({ className }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function AppLoading({ className, pageLoading, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import cx from 'classnames';
|
|
2
3
|
import ReactLoading from 'react-loading';
|
|
3
4
|
import './style.scss';
|
|
4
|
-
export default function AppLoading({ className = '' }) {
|
|
5
|
-
|
|
5
|
+
export default function AppLoading({ className = '', pageLoading = false, }) {
|
|
6
|
+
const containerClassName = cx('loading-container', { 'page-loading': pageLoading }, className);
|
|
7
|
+
return (_jsx("div", { className: containerClassName, children: _jsx(ReactLoading, { type: "spinningBubbles", color: "blue", height: 50, width: 50 }) }));
|
|
6
8
|
}
|
|
@@ -5,12 +5,11 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
5
|
import { Button, Icon, IconButton, Tag } from 'tycho-storybook';
|
|
6
6
|
import { useCorpusUtils } from '../../configs/useCorpusUtils';
|
|
7
7
|
import { useLoggedUtils } from '../../configs/useLoggedUtils';
|
|
8
|
-
import UsabilityUtils from '../../functions/UsabilityUtils';
|
|
9
8
|
import { AvailableApps } from '../types/App';
|
|
10
9
|
import logo from './logo.png';
|
|
11
10
|
import './style.scss';
|
|
12
11
|
export default function HeaderApps({ freeAccess }) {
|
|
13
|
-
const { t } = useTranslation('header');
|
|
12
|
+
const { t } = useTranslation('header-app');
|
|
14
13
|
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
15
14
|
const { hasLexiconAccess, hasParserAccess, isAdminOfAnyCorpus } = useLoggedUtils();
|
|
16
15
|
const [open, setOpen] = useState(false);
|
|
@@ -35,18 +34,15 @@ export default function HeaderApps({ freeAccess }) {
|
|
|
35
34
|
return null;
|
|
36
35
|
if (item.parser && !hasParserAccess())
|
|
37
36
|
return null;
|
|
38
|
-
|
|
39
|
-
return null;
|
|
40
|
-
return (_jsxs("div", { className: "item", title: t(`${item.code}.desc`), children: [item.icon && (_jsx("div", { className: "icon", children: _jsx(Icon, { name: item.icon }) })), item.image && _jsx("img", { src: item.image }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "label", children: t(`${item.code}.name`) }), _jsx("span", { className: "sublabel", children: t(`${item.code}.desc`) })] }), _jsxs("div", { className: "options", children: [item.visibility && (_jsx(Tag, { text: item.visibility, size: "small", color: "green" })), item.external ? (_jsx(Button, { text: t('button.open'), size: "x-small", mode: "tonal", icon: "open_in_new", onClick: () => window.open(item.external, '_blank') })) : (_jsxs(_Fragment, { children: [_jsx(Button, { text: t('button.open'), size: "x-small", mode: "tonal", onClick: () => goto(item, false) }), _jsx(IconButton, { name: "open_in_new", size: "x-small", className: "icon-open", mode: "tonal", onClick: () => goto(item, true) })] }))] })] }, idx.valueOf()));
|
|
37
|
+
return (_jsxs("div", { className: "item", title: t(`${item.code}.desc`), children: [item.icon && (_jsx("div", { className: "icon", children: _jsx(Icon, { name: item.icon }) })), item.image && _jsx("img", { src: item.image }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "label", children: t(`${item.code}.name`) }), _jsx("span", { className: "sublabel", children: t(`${item.code}.desc`) })] }), _jsxs("div", { className: "options", children: [item.visibility && (_jsx(Tag, { text: t(`common:label.${item.visibility}`), size: "small", color: "green" })), item.external ? (_jsx(Button, { text: t('common:button.open'), size: "x-small", mode: "tonal", icon: "open_in_new", onClick: () => window.open(item.external, '_blank') })) : (_jsxs(_Fragment, { children: [_jsx(Button, { text: t('common:button.open'), size: "x-small", mode: "tonal", onClick: () => goto(item, false) }), _jsx(IconButton, { name: "open_in_new", size: "x-small", className: "icon-open", mode: "tonal", onClick: () => goto(item, true) })] }))] })] }, idx.valueOf()));
|
|
41
38
|
};
|
|
42
|
-
return (_jsxs("div", { className: "header-apps-container", children: [_jsx(IconButton, { name: "apps", className: "icon-apps", size: "large", onClick: () => setOpen(!open), filledIcon: true }), open && (_jsxs(Drawer, { anchor: "left", open: true, onClose: () => setOpen(false), className: "offcanvas-apps", children: [_jsxs("div", { className: "header", children: [_jsx("span", { className: "label", children: t('label.platform') }), _jsx(IconButton, { name: "close", size: "x-small", mode: "ghost", onClick: () => setOpen(false) })] }), _jsxs("div", { className: "body", children: [_jsx("div", { className: "title", children: t('label.tools') }), AvailableApps.map((item, idx) => renderItem(item, idx))] }), _jsxs("div", { className: "footer", children: [_jsx("div", { className: "title", children: t('label.quick') }), quickAccess.map((item, idx) => renderItem(item, idx))] })] }))] }));
|
|
39
|
+
return (_jsxs("div", { className: "header-apps-container", children: [_jsx(IconButton, { name: "apps", className: "icon-apps", size: "large", onClick: () => setOpen(!open), filledIcon: true }), open && (_jsxs(Drawer, { anchor: "left", open: true, onClose: () => setOpen(false), className: "offcanvas-apps", children: [_jsxs("div", { className: "header", children: [_jsx("span", { className: "label", children: t('header:label.platform') }), _jsx(IconButton, { name: "close", size: "x-small", mode: "ghost", onClick: () => setOpen(false) })] }), _jsxs("div", { className: "body", children: [_jsx("div", { className: "title", children: t('label.tools') }), AvailableApps.map((item, idx) => renderItem(item, idx))] }), _jsxs("div", { className: "footer", children: [_jsx("div", { className: "title", children: t('label.quick') }), quickAccess.map((item, idx) => renderItem(item, idx))] })] }))] }));
|
|
43
40
|
}
|
|
44
41
|
const quickAccess = [
|
|
45
42
|
{
|
|
46
43
|
code: 'platform',
|
|
47
44
|
image: logo,
|
|
48
45
|
visibility: 'public',
|
|
49
|
-
desktop: false,
|
|
50
46
|
external: 'https://www.tycho.iel.unicamp.br',
|
|
51
47
|
},
|
|
52
48
|
];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Drawer } from '@mui/material';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button, Icon, IconButton, Tag } from 'tycho-storybook';
|
|
6
|
+
import { useCorpusUtils } from '../../configs/useCorpusUtils';
|
|
7
|
+
import { AvailableAppsDesktop } from '../types/App';
|
|
8
|
+
import './style.scss';
|
|
9
|
+
export default function HeaderAppsDesktop({ freeAccess }) {
|
|
10
|
+
const { t } = useTranslation('header-app');
|
|
11
|
+
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
12
|
+
const [open, setOpen] = useState(false);
|
|
13
|
+
const goto = (app, blank) => {
|
|
14
|
+
const shouldAppendCorpusUid = app.appendCorpusUid !== false;
|
|
15
|
+
const url = hasCorpus() && shouldAppendCorpusUid
|
|
16
|
+
? `/${app.code}/${getCorpus().uid}`
|
|
17
|
+
: `/${app.code}`;
|
|
18
|
+
if (blank) {
|
|
19
|
+
window.open(url, '_blank');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
location.href = url;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const renderItem = (item, idx) => {
|
|
26
|
+
return (_jsxs("div", { className: "item", title: t(`${item.code}.desc`), children: [item.icon && (_jsx("div", { className: "icon", children: _jsx(Icon, { name: item.icon }) })), item.image && _jsx("img", { src: item.image }), _jsxs("div", { className: "texts", children: [_jsx("span", { className: "label", children: t(`${item.code}.name`) }), _jsx("span", { className: "sublabel", children: t(`${item.code}.desc`) })] }), _jsxs("div", { className: "options", children: [item.visibility && (_jsx(Tag, { text: t(`common:label.${item.visibility}`), size: "small", color: "green" })), item.external ? (_jsx(Button, { text: t('common:button.open'), size: "x-small", mode: "tonal", icon: "open_in_new", onClick: () => window.open(item.external, '_blank') })) : (_jsxs(_Fragment, { children: [_jsx(Button, { text: t('common:button.open'), size: "x-small", mode: "tonal", onClick: () => goto(item, false) }), _jsx(IconButton, { name: "open_in_new", size: "x-small", className: "icon-open", mode: "tonal", onClick: () => goto(item, true) })] }))] })] }, idx.valueOf()));
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { className: "header-apps-container", children: [_jsx(IconButton, { name: "apps", className: "icon-apps", size: "large", onClick: () => setOpen(!open), filledIcon: true }), open && (_jsxs(Drawer, { anchor: "left", open: true, onClose: () => setOpen(false), className: "offcanvas-apps", children: [_jsxs("div", { className: "header", children: [_jsx("span", { className: "label", children: t('header:label.platform') }), _jsx(IconButton, { name: "close", size: "x-small", mode: "ghost", onClick: () => setOpen(false) })] }), _jsxs("div", { className: "body", children: [_jsx("div", { className: "title", children: t('label.tools') }), AvailableAppsDesktop.map((item, idx) => renderItem(item, idx))] })] }))] }));
|
|
29
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useParams } from 'react-router-dom';
|
|
@@ -7,6 +7,7 @@ import AppPicture from '../../AppPicture';
|
|
|
7
7
|
import { useCorpusUtils } from '../../configs/useCorpusUtils';
|
|
8
8
|
import CorpusService from '../types/CorpusService';
|
|
9
9
|
import './style.scss';
|
|
10
|
+
import HeaderCorpus from './HeaderCorpus';
|
|
10
11
|
export default function HeaderCorpora({ navigateCorpora, redirect, autoload, freeAccess, }) {
|
|
11
12
|
const { t } = useTranslation('header');
|
|
12
13
|
const { setCorpus, getCorpus, hasCorpus } = useCorpusUtils();
|
|
@@ -60,5 +61,5 @@ export default function HeaderCorpora({ navigateCorpora, redirect, autoload, fre
|
|
|
60
61
|
useEffect(() => {
|
|
61
62
|
autoload && loadAndApply();
|
|
62
63
|
}, [autoload]);
|
|
63
|
-
return (_jsxs(
|
|
64
|
+
return (_jsxs(_Fragment, { children: [hasCorpus() && _jsx(HeaderCorpus, { onClick: handleCorpusClick }), openCorpora && (_jsx(AppModal, { className: "modal-corpora", title: t('label.choose'), close: () => setOpenCorpora(false), children: corpora.map((corpus) => (_jsxs("div", { className: "item", onClick: () => handleChooseCorpus(corpus), children: [_jsx(AppPicture, { src: corpus.picture, title: corpus.name, className: "modal-corpus-image" }), _jsx("span", { children: corpus.name })] }, corpus.uid))) }))] }));
|
|
64
65
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import AppPicture from '../../AppPicture';
|
|
3
|
+
import { useCorpusUtils } from '../../configs/useCorpusUtils';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
export default function HeaderCorpus({ onClick }) {
|
|
6
|
+
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
7
|
+
return (_jsx(_Fragment, { children: hasCorpus() && (_jsxs("div", { className: "header-corpus-container", onClick: onClick, children: [_jsx(AppPicture, { src: getCorpus().picture, title: getCorpus().name, className: "header-corpus-image" }), _jsx("span", { children: getCorpus().name })] })) }));
|
|
8
|
+
}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
.header-
|
|
1
|
+
.header-corpus-container {
|
|
2
2
|
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
cursor: pointer;
|
|
3
6
|
margin-left: auto;
|
|
4
7
|
margin-right: auto;
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
> span {
|
|
13
|
-
margin-right: var(--spacing-200);
|
|
14
|
-
margin-left: var(--spacing-200);
|
|
15
|
-
@include label-large-1;
|
|
16
|
-
color: var(--text-light-fixed);
|
|
17
|
-
}
|
|
9
|
+
> span {
|
|
10
|
+
margin-right: var(--spacing-200);
|
|
11
|
+
margin-left: var(--spacing-200);
|
|
12
|
+
@include label-large-1;
|
|
13
|
+
color: var(--text-light-fixed);
|
|
14
|
+
}
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
16
|
+
.header-corpus-image {
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
width: 32px;
|
|
19
|
+
height: 32px;
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
22
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HelpAction } from './HelpButton/HelpButton';
|
|
2
|
+
import './styles.scss';
|
|
3
|
+
type Props = {
|
|
4
|
+
tool: string;
|
|
5
|
+
hideKeyboard?: boolean;
|
|
6
|
+
keyboardLayout?: string;
|
|
7
|
+
navigateHome?: () => void;
|
|
8
|
+
helpActions?: HelpAction[];
|
|
9
|
+
};
|
|
10
|
+
export default function HeaderDesktop({ tool, hideKeyboard, keyboardLayout, navigateHome, helpActions, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { IconButton } from 'tycho-storybook';
|
|
6
|
+
import LanguageSelector from '../LanguageSelector';
|
|
7
|
+
import VirtualKeyboard from '../VirtualKeyboard';
|
|
8
|
+
import { useCorpusUtils } from '../configs/useCorpusUtils';
|
|
9
|
+
import HeaderAppsDesktop from './HeaderApps/HeaderAppsDesktop';
|
|
10
|
+
import HeaderCorpus from './HeaderCorpora/HeaderCorpus';
|
|
11
|
+
import HelpButton from './HelpButton';
|
|
12
|
+
import './styles.scss';
|
|
13
|
+
export default function HeaderDesktop({ tool, hideKeyboard, keyboardLayout, navigateHome, helpActions, }) {
|
|
14
|
+
const { t } = useTranslation('header');
|
|
15
|
+
const { getCorpus } = useCorpusUtils();
|
|
16
|
+
const [openKeyboard, setOpenKeyboard] = useState(false);
|
|
17
|
+
const homeTextsClass = cx('texts', {
|
|
18
|
+
pointer: navigateHome !== undefined,
|
|
19
|
+
});
|
|
20
|
+
return (_jsxs("div", { className: "ds-header", children: [_jsx(HeaderAppsDesktop, {}), _jsxs("div", { className: homeTextsClass, onClick: () => navigateHome && navigateHome(), children: [_jsx("span", { className: "title", children: t('label.desktop') }), _jsx("span", { className: "subtitle", children: tool })] }), _jsx(HeaderCorpus, {}), _jsxs("div", { className: "header-profile", children: [!hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "medium", title: t('tooltip.keyboard') })), _jsx(HelpButton, { helpActions: helpActions }), _jsx(LanguageSelector, {})] }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('common:button.close'), defaultLayout: keyboardLayout || getCorpus().keyboardLayout || 'english' }))] }));
|
|
21
|
+
}
|
package/dist/Header/styles.scss
CHANGED
|
@@ -3,7 +3,6 @@ type App = {
|
|
|
3
3
|
icon?: string;
|
|
4
4
|
image?: string;
|
|
5
5
|
visibility: 'public' | null;
|
|
6
|
-
desktop: boolean;
|
|
7
6
|
admin?: boolean;
|
|
8
7
|
lexicon?: boolean;
|
|
9
8
|
parser?: boolean;
|
|
@@ -11,4 +10,5 @@ type App = {
|
|
|
11
10
|
appendCorpusUid?: boolean;
|
|
12
11
|
};
|
|
13
12
|
export declare const AvailableApps: App[];
|
|
13
|
+
export declare const AvailableAppsDesktop: App[];
|
|
14
14
|
export default App;
|
package/dist/Header/types/App.js
CHANGED
|
@@ -3,26 +3,22 @@ export const AvailableApps = [
|
|
|
3
3
|
code: 'reserved',
|
|
4
4
|
icon: 'lock',
|
|
5
5
|
visibility: null,
|
|
6
|
-
desktop: false,
|
|
7
6
|
},
|
|
8
7
|
{
|
|
9
8
|
code: 'catalog',
|
|
10
9
|
icon: 'auto_stories',
|
|
11
10
|
visibility: null,
|
|
12
|
-
desktop: true,
|
|
13
11
|
},
|
|
14
12
|
{
|
|
15
13
|
code: 'admin',
|
|
16
14
|
icon: 'folder_managed',
|
|
17
15
|
visibility: null,
|
|
18
|
-
desktop: true,
|
|
19
16
|
admin: true,
|
|
20
17
|
},
|
|
21
18
|
{
|
|
22
19
|
code: 'parser',
|
|
23
20
|
icon: 'settings',
|
|
24
21
|
visibility: null,
|
|
25
|
-
desktop: true,
|
|
26
22
|
parser: true,
|
|
27
23
|
appendCorpusUid: false,
|
|
28
24
|
},
|
|
@@ -30,13 +26,11 @@ export const AvailableApps = [
|
|
|
30
26
|
code: 'io',
|
|
31
27
|
icon: 'swap_vert',
|
|
32
28
|
visibility: null,
|
|
33
|
-
desktop: true,
|
|
34
29
|
},
|
|
35
30
|
{
|
|
36
31
|
code: 'lexicon',
|
|
37
32
|
icon: 'book_3',
|
|
38
33
|
visibility: null,
|
|
39
|
-
desktop: false,
|
|
40
34
|
lexicon: true,
|
|
41
35
|
appendCorpusUid: false,
|
|
42
36
|
},
|
|
@@ -44,27 +38,55 @@ export const AvailableApps = [
|
|
|
44
38
|
code: 'search',
|
|
45
39
|
icon: 'match_word',
|
|
46
40
|
visibility: 'public',
|
|
47
|
-
desktop: true,
|
|
48
41
|
},
|
|
49
42
|
{
|
|
50
43
|
code: 'viewer',
|
|
51
44
|
icon: 'news',
|
|
52
45
|
visibility: 'public',
|
|
53
|
-
desktop: false,
|
|
54
46
|
appendCorpusUid: false,
|
|
55
47
|
},
|
|
56
48
|
{
|
|
57
49
|
code: 'synviewer',
|
|
58
50
|
icon: 'graph_4',
|
|
59
51
|
visibility: 'public',
|
|
60
|
-
desktop: false,
|
|
61
52
|
appendCorpusUid: false,
|
|
62
53
|
},
|
|
63
54
|
{
|
|
64
55
|
code: 'psd-reindexer',
|
|
65
56
|
icon: '123',
|
|
66
57
|
visibility: 'public',
|
|
67
|
-
|
|
58
|
+
appendCorpusUid: false,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
export const AvailableAppsDesktop = [
|
|
62
|
+
{
|
|
63
|
+
code: 'catalog',
|
|
64
|
+
icon: 'auto_stories',
|
|
65
|
+
visibility: 'public',
|
|
66
|
+
appendCorpusUid: false,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
code: 'syntrees',
|
|
70
|
+
icon: 'graph_4',
|
|
71
|
+
visibility: 'public',
|
|
72
|
+
appendCorpusUid: false,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
code: 'search',
|
|
76
|
+
icon: 'match_word',
|
|
77
|
+
visibility: 'public',
|
|
78
|
+
appendCorpusUid: false,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
code: 'parser',
|
|
82
|
+
icon: 'automation',
|
|
83
|
+
visibility: 'public',
|
|
84
|
+
appendCorpusUid: false,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
code: 'settings',
|
|
88
|
+
icon: 'graph_4',
|
|
89
|
+
visibility: 'public',
|
|
68
90
|
appendCorpusUid: false,
|
|
69
91
|
},
|
|
70
92
|
];
|
|
@@ -12,7 +12,6 @@ export type Props = {
|
|
|
12
12
|
export type AvailableLanguage = {
|
|
13
13
|
value: string;
|
|
14
14
|
name: string;
|
|
15
|
-
flag: string;
|
|
16
15
|
};
|
|
17
16
|
export declare const AvailableLanguages: AvailableLanguage[];
|
|
18
17
|
export default function LanguageSelector({ className, color, size, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -3,9 +3,6 @@ import cx from 'classnames';
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Icon } from 'tycho-storybook';
|
|
6
|
-
import brFlag from './flags/br.svg';
|
|
7
|
-
import itFlag from './flags/it.svg';
|
|
8
|
-
import usFlag from './flags/us.svg';
|
|
9
6
|
import './styles.scss';
|
|
10
7
|
export const LanguageSelectorModes = ['white', 'blue'];
|
|
11
8
|
export const LanguageSelectorSizes = ['large', 'medium', 'small'];
|
|
@@ -18,17 +15,14 @@ export const AvailableLanguages = [
|
|
|
18
15
|
{
|
|
19
16
|
value: 'en',
|
|
20
17
|
name: 'English',
|
|
21
|
-
flag: usFlag,
|
|
22
18
|
},
|
|
23
19
|
{
|
|
24
20
|
value: 'pt-BR',
|
|
25
21
|
name: 'Português-Brasil',
|
|
26
|
-
flag: brFlag,
|
|
27
22
|
},
|
|
28
23
|
{
|
|
29
24
|
value: 'it',
|
|
30
25
|
name: 'Italiano',
|
|
31
|
-
flag: itFlag,
|
|
32
26
|
},
|
|
33
27
|
];
|
|
34
28
|
export default function LanguageSelector({ className, color = 'primary', size = 'medium', }) {
|
|
@@ -54,5 +48,5 @@ export default function LanguageSelector({ className, color = 'primary', size =
|
|
|
54
48
|
}, []);
|
|
55
49
|
if (!language)
|
|
56
50
|
return null;
|
|
57
|
-
return (_jsx("div", { className: getClassNames, children: _jsxs("div", { className: "ds-dropdown-container", children: [_jsxs("div", { className: getClassNamesDropdown, onClick: () => setOpen(!open), children: [_jsx("
|
|
51
|
+
return (_jsx("div", { className: getClassNames, children: _jsxs("div", { className: "ds-dropdown-container", children: [_jsxs("div", { className: getClassNamesDropdown, onClick: () => setOpen(!open), children: [_jsx("span", { className: "label", children: language.value }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), open && (_jsx("div", { className: "ds-dropdown-list", children: AvailableLanguages.map((item, idx) => (_jsxs("div", { className: "ds-dropdown-itemlist", onClick: () => changeLanguageHandler(item), children: [_jsx("span", { className: "label", children: item.name }), _jsx("span", { className: "sublabel", children: item.value }), item.value === language.label && (_jsx(Icon, { name: "check", size: "x-small", className: "icon-check" }))] }, idx.valueOf()))) }))] }) }));
|
|
58
52
|
}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
.language-container {
|
|
2
2
|
> .ds-dropdown-container {
|
|
3
3
|
.ds-dropdown-button {
|
|
4
|
-
|
|
5
|
-
margin-left: var(--spacing-100);
|
|
6
|
-
margin-right: var(--spacing-050);
|
|
7
|
-
|
|
8
|
-
> img {
|
|
9
|
-
width: 24px !important;
|
|
10
|
-
height: 24px !important;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
4
|
+
padding-left: 8px;
|
|
13
5
|
|
|
14
6
|
.label {
|
|
15
7
|
margin-right: var(--spacing-100);
|
|
@@ -24,17 +16,6 @@
|
|
|
24
16
|
display: flex;
|
|
25
17
|
align-items: center;
|
|
26
18
|
|
|
27
|
-
.flag {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
margin-right: 8px;
|
|
31
|
-
|
|
32
|
-
> img {
|
|
33
|
-
width: 20px !important;
|
|
34
|
-
height: 20px !important;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
19
|
.icon-check {
|
|
39
20
|
margin-left: var(--spacing-100);
|
|
40
21
|
}
|