mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
added sidebar router
This commit is contained in:
parent
8a4709103b
commit
8a71d3d462
18 changed files with 166 additions and 108 deletions
|
@ -1,19 +1,22 @@
|
|||
import { FC } from 'react';
|
||||
import { FC, useCallback } from 'react';
|
||||
|
||||
import { useRouter } from 'next/router';
|
||||
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { Button } from '~/components/input/Button';
|
||||
import { Dialog } from '~/constants/modal';
|
||||
import { SidebarName } from '~/constants/sidebar';
|
||||
import { URLS } from '~/constants/urls';
|
||||
import { useShowModal } from '~/hooks/modal/useShowModal';
|
||||
import { useSidebar } from '~/utils/providers/SidebarProvider';
|
||||
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
export interface BorisSuperpowersProps {}
|
||||
|
||||
const BorisSuperpowers: FC<BorisSuperpowersProps> = () => {
|
||||
const openProfileSidebar = useShowModal(Dialog.ProfileSidebar);
|
||||
const { open } = useSidebar();
|
||||
const openProfileSidebar = useCallback(() => {
|
||||
open(SidebarName.Settings);
|
||||
}, [open]);
|
||||
const { push } = useRouter();
|
||||
|
||||
return (
|
||||
|
@ -21,7 +24,7 @@ const BorisSuperpowers: FC<BorisSuperpowersProps> = () => {
|
|||
<h2>Штучи, находящиеся в разработке</h2>
|
||||
|
||||
<div className={styles.grid}>
|
||||
<Button size="mini" onClick={() => openProfileSidebar({})}>
|
||||
<Button size="mini" onClick={() => openProfileSidebar()}>
|
||||
Открыть
|
||||
</Button>
|
||||
<div className={styles.label}>Профиль в сайдбаре</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { VFC } from 'react';
|
||||
import { VFC } from 'react';
|
||||
|
||||
import { ProfileSidebarNotes } from '~/components/profile/ProfileSidebarNotes';
|
||||
import { ProfileSidebarSettings } from '~/components/profile/ProfileSidebarSettings';
|
||||
|
@ -8,7 +8,9 @@ import { ProfileSidebarMenu } from '~/containers/profile/ProfileSidebarMenu';
|
|||
import { SidebarWrapper } from '~/containers/sidebars/SidebarWrapper';
|
||||
import { DialogComponentProps } from '~/types/modal';
|
||||
|
||||
interface ProfileSidebarProps extends DialogComponentProps {}
|
||||
interface ProfileSidebarProps extends DialogComponentProps {
|
||||
page: string;
|
||||
}
|
||||
|
||||
const ProfileSidebar: VFC<ProfileSidebarProps> = ({ onRequestClose }) => {
|
||||
return (
|
||||
|
|
|
@ -126,7 +126,7 @@ const TagInput: FC<IProps> = ({ exclude, onAppend, onClearTag, onSubmit }) => {
|
|||
|
||||
return (
|
||||
<div className={styles.wrap} ref={wrapper}>
|
||||
<TagWrapper title={input || placeholder} has_input={true} feature={feature}>
|
||||
<TagWrapper title={input || placeholder} hasInput={true} feature={feature}>
|
||||
<input
|
||||
type="text"
|
||||
value={input}
|
||||
|
|
|
@ -9,8 +9,8 @@ import { separateTags } from '~/utils/tag';
|
|||
|
||||
type IProps = HTMLAttributes<HTMLDivElement> & {
|
||||
tags: Partial<ITag>[];
|
||||
is_deletable?: boolean;
|
||||
is_editable?: boolean;
|
||||
deletable?: boolean;
|
||||
editable?: boolean;
|
||||
onTagsChange?: (tags: string[]) => void;
|
||||
onTagClick?: (tag: Partial<ITag>) => void;
|
||||
onTagDelete?: (id: ITag['ID']) => void;
|
||||
|
@ -18,8 +18,8 @@ type IProps = HTMLAttributes<HTMLDivElement> & {
|
|||
|
||||
export const Tags: FC<IProps> = ({
|
||||
tags,
|
||||
is_deletable,
|
||||
is_editable,
|
||||
deletable,
|
||||
editable,
|
||||
onTagsChange,
|
||||
onTagClick,
|
||||
onTagDelete,
|
||||
|
@ -78,7 +78,7 @@ export const Tags: FC<IProps> = ({
|
|||
key={tag.title}
|
||||
tag={tag}
|
||||
onClick={onTagClick}
|
||||
is_deletable={is_deletable}
|
||||
deletable={deletable}
|
||||
onDelete={onTagDelete}
|
||||
/>
|
||||
))}
|
||||
|
@ -88,16 +88,16 @@ export const Tags: FC<IProps> = ({
|
|||
key={tag.title}
|
||||
tag={tag}
|
||||
onClick={onTagClick}
|
||||
is_deletable={is_deletable}
|
||||
deletable={deletable}
|
||||
onDelete={onTagDelete}
|
||||
/>
|
||||
))}
|
||||
|
||||
{data.map(title => (
|
||||
<Tag key={title} tag={{ title }} is_editing />
|
||||
<Tag key={title} tag={{ title }} editing />
|
||||
))}
|
||||
|
||||
{is_editable && (
|
||||
{editable && (
|
||||
<TagInput
|
||||
onAppend={onAppendTag}
|
||||
onClearTag={onClearTag}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue