@equinor/fusion-framework-react-components-bookmark 1.0.8 → 1.0.10

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +234 -215
  2. package/dist/esm/components/Bookmark.js.map +1 -1
  3. package/dist/esm/components/BookmarkProvider.js.map +1 -1
  4. package/dist/esm/components/create-bookmark/CreateBookmark.js.map +1 -1
  5. package/dist/esm/components/edit-bookmark/EditBookmark.js +1 -3
  6. package/dist/esm/components/edit-bookmark/EditBookmark.js.map +1 -1
  7. package/dist/esm/components/filter/Filter.js +2 -5
  8. package/dist/esm/components/filter/Filter.js.map +1 -1
  9. package/dist/esm/components/import-bookmark/ImportBookmark.js.map +1 -1
  10. package/dist/esm/components/loading/Loading.js.map +1 -1
  11. package/dist/esm/components/messages/Message.js.map +1 -1
  12. package/dist/esm/components/row/MoreMenu.js.map +1 -1
  13. package/dist/esm/components/row/Row.js.map +1 -1
  14. package/dist/esm/components/section/Section.js.map +1 -1
  15. package/dist/esm/components/sectionList/SectionList.js.map +1 -1
  16. package/dist/esm/components/shared/SharedIcon.js.map +1 -1
  17. package/dist/esm/hooks/useBookmarkGrouping.js.map +1 -1
  18. package/dist/esm/utils/append-bookmark-to-uri.js.map +1 -1
  19. package/dist/esm/utils/utils.js.map +1 -1
  20. package/dist/esm/version.js +1 -1
  21. package/dist/esm/version.js.map +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/types/components/BookmarkProvider.d.ts +1 -1
  24. package/dist/types/components/filter/Filter.d.ts +1 -1
  25. package/dist/types/components/messages/Message.d.ts +1 -1
  26. package/dist/types/components/row/MoreMenu.d.ts +2 -2
  27. package/dist/types/components/row/Row.d.ts +1 -1
  28. package/dist/types/components/section/Section.d.ts +1 -1
  29. package/dist/types/components/sectionList/SectionList.d.ts +1 -1
  30. package/dist/types/hooks/useBookmarkGrouping.d.ts +1 -1
  31. package/dist/types/utils/utils.d.ts +1 -1
  32. package/dist/types/version.d.ts +1 -1
  33. package/package.json +8 -8
  34. package/src/components/Bookmark.tsx +46 -47
  35. package/src/components/BookmarkProvider.tsx +78 -78
  36. package/src/components/create-bookmark/CreateBookmark.tsx +96 -96
  37. package/src/components/edit-bookmark/EditBookmark.tsx +149 -152
  38. package/src/components/filter/Filter.tsx +21 -41
  39. package/src/components/import-bookmark/ImportBookmark.tsx +61 -65
  40. package/src/components/loading/Loading.tsx +11 -11
  41. package/src/components/messages/Message.tsx +47 -47
  42. package/src/components/row/MoreMenu.tsx +27 -27
  43. package/src/components/row/Row.tsx +56 -56
  44. package/src/components/section/Section.tsx +17 -17
  45. package/src/components/sectionList/SectionList.tsx +137 -143
  46. package/src/components/shared/SharedIcon.tsx +19 -19
  47. package/src/hooks/useBookmarkGrouping.ts +37 -37
  48. package/src/utils/append-bookmark-to-uri.ts +3 -3
  49. package/src/utils/utils.ts +6 -6
  50. package/src/version.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
2
2
  import { type PropsWithChildren } from 'react';
3
- import { type IBookmarkProvider } from '@equinor/fusion-framework-module-bookmark';
3
+ import type { IBookmarkProvider } from '@equinor/fusion-framework-module-bookmark';
4
4
  type BookmarkApp = {
5
5
  appKey: string;
6
6
  name?: string;
@@ -1,4 +1,4 @@
1
- import { GroupingKeys } from '../../hooks/useBookmarkGrouping';
1
+ import type { GroupingKeys } from '../../hooks/useBookmarkGrouping';
2
2
  type BookmarkFilterProps = {
3
3
  readonly searchText: string;
4
4
  readonly setSearchText: (newVal: string | null) => void;
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import type { PropsWithChildren } from 'react';
2
2
  export type PortalMessageType = 'Error' | 'Info' | 'Warning' | 'NoContent';
3
3
  type MessageProps = {
4
4
  readonly title: string;
@@ -1,5 +1,5 @@
1
- import { MutableRefObject } from 'react';
2
- import { MenuOption } from './Row';
1
+ import type { MutableRefObject } from 'react';
2
+ import type { MenuOption } from './Row';
3
3
  type MenuProps = {
4
4
  readonly pRef: MutableRefObject<HTMLElement | null>;
5
5
  readonly onClose: VoidFunction;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  export type MenuOption = {
3
3
  name: string;
4
4
  disabled: boolean;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  type SectionProps = {
3
3
  readonly name: string;
4
4
  readonly children: ReactNode;
@@ -1,4 +1,4 @@
1
- import { useBookmarkGrouping } from '../../hooks';
1
+ import type { useBookmarkGrouping } from '../../hooks';
2
2
  type SectionListProps = {
3
3
  readonly bookmarkGroups: ReturnType<typeof useBookmarkGrouping>['bookmarkGroups'];
4
4
  };
@@ -1,4 +1,4 @@
1
- import { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
1
+ import type { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
2
2
  export type GroupingKeys = 'Group by app' | 'Created by' | 'Group by Context';
3
3
  export declare const useBookmarkGrouping: (bookmarks?: Bookmarks) => {
4
4
  setGroupBy: import("react").Dispatch<import("react").SetStateAction<GroupingKeys>>;
@@ -1,4 +1,4 @@
1
- import { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
1
+ import type { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
2
2
  /** Helpers.. */
3
3
  export declare const filterEmptyGroups: (i: {
4
4
  values: Bookmarks;
@@ -1 +1 @@
1
- export declare const version = "1.0.8";
1
+ export declare const version = "1.0.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-react-components-bookmark",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "exports": {
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "rxjs": "^7.8.1",
26
- "@equinor/fusion-framework-react": "^7.4.0",
27
- "@equinor/fusion-observable": "^8.4.4",
28
- "@equinor/fusion-framework-react-module-bookmark": "^3.0.0"
26
+ "@equinor/fusion-framework-react": "^7.4.2",
27
+ "@equinor/fusion-framework-react-module-bookmark": "^3.0.2",
28
+ "@equinor/fusion-observable": "^8.4.5"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@equinor/eds-core-react": "^0.43.0",
@@ -35,10 +35,10 @@
35
35
  "@types/react": "^18.2.50",
36
36
  "react": "^18.2.0",
37
37
  "styled-components": "^6.0.7",
38
- "typescript": "^5.5.4",
39
- "@equinor/fusion-framework-module-bookmark": "^2.1.1",
40
- "@equinor/fusion-framework-module-app": "^6.1.4",
41
- "@equinor/fusion-framework-module-event": "^4.3.0"
38
+ "typescript": "^5.7.3",
39
+ "@equinor/fusion-framework-module-app": "^6.1.5",
40
+ "@equinor/fusion-framework-module-event": "^4.3.1",
41
+ "@equinor/fusion-framework-module-bookmark": "^2.1.2"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@equinor/eds-core-react": "^0.37.0",
@@ -14,26 +14,26 @@ import { useBookmarkComponentContext } from './BookmarkProvider';
14
14
  import { useObservableState } from '@equinor/fusion-observable/react';
15
15
 
16
16
  Icon.add({
17
- chevron_down,
18
- chevron_right,
19
- share,
20
- more_vertical,
21
- add,
17
+ chevron_down,
18
+ chevron_right,
19
+ share,
20
+ more_vertical,
21
+ add,
22
22
  });
23
23
 
24
24
  const Styled = {
25
- Wrapper: styled.div`
25
+ Wrapper: styled.div`
26
26
  padding-right: 1rem;
27
27
  display: flex;
28
28
  flex-direction: column;
29
29
  gap: 1rem;
30
30
  `,
31
- List: styled.div`
31
+ List: styled.div`
32
32
  overflow-y: auto;
33
33
  overflow-x: hidden;
34
34
  height: calc((100vh - 85px) - 3rem);
35
35
  `,
36
- NoContentWrapper: styled.div`
36
+ NoContentWrapper: styled.div`
37
37
  position: absolute;
38
38
  top: 150px;
39
39
  bottom: 200px;
@@ -43,50 +43,49 @@ const Styled = {
43
43
  };
44
44
 
45
45
  export const Bookmark = () => {
46
- const { provider } = useBookmarkComponentContext();
46
+ const { provider } = useBookmarkComponentContext();
47
47
 
48
- const { value: bookmarks } = useObservableState(
49
- useMemo(() => provider?.bookmarks$ || EMPTY, [provider]),
50
- );
48
+ const { value: bookmarks } = useObservableState(
49
+ useMemo(() => provider?.bookmarks$ || EMPTY, [provider]),
50
+ );
51
51
 
52
- const { value: isLoading } = useObservableState(
53
- useMemo(
54
- () =>
55
- (provider?.status$ || EMPTY).pipe(map((status) => !!status.has('fetch_bookmarks'))),
56
- [provider],
57
- ),
58
- { initial: true },
59
- );
52
+ const { value: isLoading } = useObservableState(
53
+ useMemo(
54
+ () => (provider?.status$ || EMPTY).pipe(map((status) => !!status.has('fetch_bookmarks'))),
55
+ [provider],
56
+ ),
57
+ { initial: true },
58
+ );
60
59
 
61
- const { bookmarkGroups, groupingModes, searchText, setGroupBy, setSearchText, groupByKey } =
62
- useBookmarkGrouping(bookmarks);
60
+ const { bookmarkGroups, groupingModes, searchText, setGroupBy, setSearchText, groupByKey } =
61
+ useBookmarkGrouping(bookmarks);
63
62
 
64
- const content = useMemo(() => {
65
- if (isLoading) {
66
- return <Loading />;
67
- }
68
- if (bookmarkGroups.length === 0) {
69
- return (
70
- <Message title="No Bookmarks" type="NoContent">
71
- You have not created any bookmarks yet.
72
- </Message>
73
- );
74
- }
75
- return <SectionList bookmarkGroups={bookmarkGroups} />;
76
- }, [isLoading, bookmarkGroups]);
63
+ const content = useMemo(() => {
64
+ if (isLoading) {
65
+ return <Loading />;
66
+ }
67
+ if (bookmarkGroups.length === 0) {
68
+ return (
69
+ <Message title="No Bookmarks" type="NoContent">
70
+ You have not created any bookmarks yet.
71
+ </Message>
72
+ );
73
+ }
74
+ return <SectionList bookmarkGroups={bookmarkGroups} />;
75
+ }, [isLoading, bookmarkGroups]);
77
76
 
78
- return (
79
- <Styled.Wrapper>
80
- <BookmarkFilter
81
- groupBy={groupByKey}
82
- groupingModes={Object.keys(groupingModes)}
83
- searchText={searchText ?? ''}
84
- setGroupBy={setGroupBy}
85
- setSearchText={setSearchText}
86
- />
87
- <Styled.List>{content}</Styled.List>
88
- </Styled.Wrapper>
89
- );
77
+ return (
78
+ <Styled.Wrapper>
79
+ <BookmarkFilter
80
+ groupBy={groupByKey}
81
+ groupingModes={Object.keys(groupingModes)}
82
+ searchText={searchText ?? ''}
83
+ setGroupBy={setGroupBy}
84
+ setSearchText={setSearchText}
85
+ />
86
+ <Styled.List>{content}</Styled.List>
87
+ </Styled.Wrapper>
88
+ );
90
89
  };
91
90
 
92
91
  export default Bookmark;
@@ -4,110 +4,110 @@ import { type PropsWithChildren, createContext, useCallback, useContext, useStat
4
4
  import { CreateBookmarkModal } from './create-bookmark';
5
5
  import { EditBookmarkModal } from './edit-bookmark';
6
6
  import { ImportBookmarkModal } from './import-bookmark';
7
- import { type IBookmarkProvider } from '@equinor/fusion-framework-module-bookmark';
7
+ import type { IBookmarkProvider } from '@equinor/fusion-framework-module-bookmark';
8
8
 
9
9
  type BookmarkApp = {
10
- appKey: string;
11
- name?: string;
10
+ appKey: string;
11
+ name?: string;
12
12
  };
13
13
 
14
14
  type BookmarkUser = {
15
- id: string;
16
- name?: string;
15
+ id: string;
16
+ name?: string;
17
17
  };
18
18
 
19
19
  type ProviderState = {
20
- provider?: IBookmarkProvider;
21
- currentApp?: BookmarkApp | null;
22
- currentUser?: BookmarkUser | null;
23
- showCreateBookmark: () => void;
24
- showEditBookmark: (bookmarkId: string) => void;
25
- addBookmarkToClipboard: (bookmarkId: string) => void;
20
+ provider?: IBookmarkProvider;
21
+ currentApp?: BookmarkApp | null;
22
+ currentUser?: BookmarkUser | null;
23
+ showCreateBookmark: () => void;
24
+ showEditBookmark: (bookmarkId: string) => void;
25
+ addBookmarkToClipboard: (bookmarkId: string) => void;
26
26
  };
27
27
 
28
28
  const bookmarkProviderContext = createContext<ProviderState | null>(null);
29
29
 
30
30
  type BookmarkProviderProps = {
31
- readonly provider?: IBookmarkProvider;
32
- readonly currentApp?: BookmarkApp;
33
- readonly currentUser?: BookmarkUser;
31
+ readonly provider?: IBookmarkProvider;
32
+ readonly currentApp?: BookmarkApp;
33
+ readonly currentUser?: BookmarkUser;
34
34
  };
35
35
 
36
36
  export const useBookmarkComponentContext = () =>
37
- useContext(bookmarkProviderContext) as ProviderState;
37
+ useContext(bookmarkProviderContext) as ProviderState;
38
38
 
39
39
  export const BookmarkProvider = (props: PropsWithChildren<BookmarkProviderProps>) => {
40
- const { provider, currentApp, currentUser, children } = props;
40
+ const { provider, currentApp, currentUser, children } = props;
41
41
 
42
- const [isCreateBookmarkOpen, setIsCreateBookmarkOpen] = useState(false);
43
- const [editBookmarkId, setEditBookmarkId] = useState<string | undefined>();
42
+ const [isCreateBookmarkOpen, setIsCreateBookmarkOpen] = useState(false);
43
+ const [editBookmarkId, setEditBookmarkId] = useState<string | undefined>();
44
44
 
45
- const showCreateBookmark = useCallback(() => {
46
- setIsCreateBookmarkOpen(true);
47
- }, []);
45
+ const showCreateBookmark = useCallback(() => {
46
+ setIsCreateBookmarkOpen(true);
47
+ }, []);
48
48
 
49
- const [snackbarContent, setSnackbarContent] = useState('');
49
+ const [snackbarContent, setSnackbarContent] = useState('');
50
50
 
51
- const addBookmarkToClipboard = useCallback((bookmarkId: string) => {
52
- const url = new URL(window.location.toString());
53
- url.searchParams.set('bookmarkId', bookmarkId);
54
- navigator.clipboard.writeText(String(url));
55
- setSnackbarContent('Bookmark url copied to clipboard');
56
- }, []);
57
-
58
- if (!provider) {
59
- return (
60
- <bookmarkProviderContext.Provider
61
- value={{
62
- provider: undefined,
63
- currentApp,
64
- currentUser,
65
- showCreateBookmark,
66
- showEditBookmark: setEditBookmarkId,
67
- addBookmarkToClipboard,
68
- }}
69
- >
70
- {children}
71
- </bookmarkProviderContext.Provider>
72
- );
73
- }
51
+ const addBookmarkToClipboard = useCallback((bookmarkId: string) => {
52
+ const url = new URL(window.location.toString());
53
+ url.searchParams.set('bookmarkId', bookmarkId);
54
+ navigator.clipboard.writeText(String(url));
55
+ setSnackbarContent('Bookmark url copied to clipboard');
56
+ }, []);
74
57
 
58
+ if (!provider) {
75
59
  return (
76
- <bookmarkProviderContext.Provider
77
- value={{
78
- provider,
79
- currentApp,
80
- currentUser,
81
- showCreateBookmark,
82
- showEditBookmark: setEditBookmarkId,
83
- addBookmarkToClipboard,
84
- }}
85
- >
86
- <CreateBookmarkModal isOpen={isCreateBookmarkOpen} onClose={setIsCreateBookmarkOpen} />
87
- {editBookmarkId && (
88
- <EditBookmarkModal
89
- isOpen={!!editBookmarkId}
90
- onClose={() => setEditBookmarkId(undefined)}
91
- bookmarkId={editBookmarkId}
92
- />
93
- )}
94
- <ImportBookmarkModal />
95
- <Snackbar
96
- autoHideDuration={2000}
97
- onClose={() => setSnackbarContent('')}
98
- open={!!snackbarContent}
99
- >
100
- {snackbarContent}
101
- </Snackbar>
102
- {children}
103
- </bookmarkProviderContext.Provider>
60
+ <bookmarkProviderContext.Provider
61
+ value={{
62
+ provider: undefined,
63
+ currentApp,
64
+ currentUser,
65
+ showCreateBookmark,
66
+ showEditBookmark: setEditBookmarkId,
67
+ addBookmarkToClipboard,
68
+ }}
69
+ >
70
+ {children}
71
+ </bookmarkProviderContext.Provider>
104
72
  );
73
+ }
74
+
75
+ return (
76
+ <bookmarkProviderContext.Provider
77
+ value={{
78
+ provider,
79
+ currentApp,
80
+ currentUser,
81
+ showCreateBookmark,
82
+ showEditBookmark: setEditBookmarkId,
83
+ addBookmarkToClipboard,
84
+ }}
85
+ >
86
+ <CreateBookmarkModal isOpen={isCreateBookmarkOpen} onClose={setIsCreateBookmarkOpen} />
87
+ {editBookmarkId && (
88
+ <EditBookmarkModal
89
+ isOpen={!!editBookmarkId}
90
+ onClose={() => setEditBookmarkId(undefined)}
91
+ bookmarkId={editBookmarkId}
92
+ />
93
+ )}
94
+ <ImportBookmarkModal />
95
+ <Snackbar
96
+ autoHideDuration={2000}
97
+ onClose={() => setSnackbarContent('')}
98
+ open={!!snackbarContent}
99
+ >
100
+ {snackbarContent}
101
+ </Snackbar>
102
+ {children}
103
+ </bookmarkProviderContext.Provider>
104
+ );
105
105
  };
106
106
 
107
107
  declare module '@equinor/fusion-framework-module-event' {
108
- interface FrameworkEventMap {
109
- // onBookmarkOpen: FrameworkEvent<FrameworkEventInit<boolean, unknown>>;
110
- onBookmarkEdit: FrameworkEvent<FrameworkEventInit<{ bookmarkId: string }, unknown>>;
111
- onBookmarkUrlCopy: FrameworkEvent<FrameworkEventInit<{ url: string }, unknown>>;
112
- }
108
+ interface FrameworkEventMap {
109
+ // onBookmarkOpen: FrameworkEvent<FrameworkEventInit<boolean, unknown>>;
110
+ onBookmarkEdit: FrameworkEvent<FrameworkEventInit<{ bookmarkId: string }, unknown>>;
111
+ onBookmarkUrlCopy: FrameworkEvent<FrameworkEventInit<{ url: string }, unknown>>;
112
+ }
113
113
  }
@@ -1,6 +1,6 @@
1
- import { ChangeEvent, useCallback, useEffect, useState } from 'react';
1
+ import { type ChangeEvent, useCallback, useEffect, useState } from 'react';
2
2
 
3
- import { BookmarkCreateArgs } from '@equinor/fusion-framework-module-bookmark';
3
+ import type { BookmarkCreateArgs } from '@equinor/fusion-framework-module-bookmark';
4
4
  import { useBookmarkComponentContext } from '../BookmarkProvider';
5
5
 
6
6
  import { Button, Checkbox, Dialog, Input, Label, TextField } from '@equinor/eds-core-react';
@@ -15,106 +15,106 @@ const StyledContent = styled(Dialog.Content)`
15
15
  `;
16
16
 
17
17
  export const CreateBookmarkModal = ({
18
- isOpen,
19
- onClose,
18
+ isOpen,
19
+ onClose,
20
20
  }: {
21
- readonly isOpen: boolean;
22
- readonly onClose: (b: boolean) => void;
21
+ readonly isOpen: boolean;
22
+ readonly onClose: (b: boolean) => void;
23
23
  }) => {
24
- const { provider, currentApp } = useBookmarkComponentContext();
24
+ const { provider, currentApp } = useBookmarkComponentContext();
25
25
 
26
- const [state, setState] = useState<BookmarkCreateArgs<never>>({
27
- name: '',
28
- description: '',
29
- isShared: false,
30
- });
26
+ const [state, setState] = useState<BookmarkCreateArgs<never>>({
27
+ name: '',
28
+ description: '',
29
+ isShared: false,
30
+ });
31
31
 
32
- useEffect(() => {
33
- setState((s) => ({ ...s, appKey: currentApp?.appKey || '' }));
34
- }, [currentApp]);
32
+ useEffect(() => {
33
+ setState((s) => ({ ...s, appKey: currentApp?.appKey || '' }));
34
+ }, [currentApp]);
35
35
 
36
- const createBookmark = useCallback(
37
- async (args: BookmarkCreateArgs<never>) => {
38
- if (!provider) {
39
- console.error('Provider not available');
40
- return;
41
- }
42
- // TODO: Show success message
43
- // TODO: should this call onCreated, with the new bookmark?
44
- // TODO: should current bookmark be updated?
45
- const sub = from(provider.createBookmark(args)).subscribe({
46
- next: (bookmark) => {
47
- console.debug('Bookmark created', bookmark);
48
- },
49
- error: (error) => {
50
- console.error('Failed to create bookmark', error);
51
- },
52
- complete() {
53
- onClose(false);
54
- },
55
- });
56
- return () => sub.unsubscribe();
36
+ const createBookmark = useCallback(
37
+ async (args: BookmarkCreateArgs<never>) => {
38
+ if (!provider) {
39
+ console.error('Provider not available');
40
+ return;
41
+ }
42
+ // TODO: Show success message
43
+ // TODO: should this call onCreated, with the new bookmark?
44
+ // TODO: should current bookmark be updated?
45
+ const sub = from(provider.createBookmark(args)).subscribe({
46
+ next: (bookmark) => {
47
+ console.debug('Bookmark created', bookmark);
57
48
  },
58
- [onClose, provider],
59
- );
49
+ error: (error) => {
50
+ console.error('Failed to create bookmark', error);
51
+ },
52
+ complete() {
53
+ onClose(false);
54
+ },
55
+ });
56
+ return () => sub.unsubscribe();
57
+ },
58
+ [onClose, provider],
59
+ );
60
60
 
61
- return (
62
- <Dialog style={{ width: '400px' }} open={isOpen}>
63
- <Dialog.Header>Create bookmark</Dialog.Header>
64
- <StyledContent>
65
- <div>
66
- <Label htmlFor="name" label="Name" />
67
- <Input
68
- id="name"
69
- autoComplete="off"
70
- value={state?.name}
71
- onChange={(event: ChangeEvent<HTMLInputElement>) => {
72
- setState((s) => ({ ...s, name: event.target.value }));
73
- }}
74
- />
75
- </div>
76
- <div>
77
- <TextField
78
- id="storybook-multiline-three"
79
- label="Description"
80
- multiline
81
- rows={3}
82
- rowsMax={10}
83
- onChange={(event: ChangeEvent<HTMLInputElement>) => {
84
- setState((s) => ({ ...s, description: event.target.value }));
85
- }}
86
- />
87
- </div>
88
- <div>
89
- <Label htmlFor="app" label="App" />
90
- <Input readOnly={true} value={currentApp?.name || currentApp?.appKey || ''} />
91
- </div>
61
+ return (
62
+ <Dialog style={{ width: '400px' }} open={isOpen}>
63
+ <Dialog.Header>Create bookmark</Dialog.Header>
64
+ <StyledContent>
65
+ <div>
66
+ <Label htmlFor="name" label="Name" />
67
+ <Input
68
+ id="name"
69
+ autoComplete="off"
70
+ value={state?.name}
71
+ onChange={(event: ChangeEvent<HTMLInputElement>) => {
72
+ setState((s) => ({ ...s, name: event.target.value }));
73
+ }}
74
+ />
75
+ </div>
76
+ <div>
77
+ <TextField
78
+ id="storybook-multiline-three"
79
+ label="Description"
80
+ multiline
81
+ rows={3}
82
+ rowsMax={10}
83
+ onChange={(event: ChangeEvent<HTMLInputElement>) => {
84
+ setState((s) => ({ ...s, description: event.target.value }));
85
+ }}
86
+ />
87
+ </div>
88
+ <div>
89
+ <Label htmlFor="app" label="App" />
90
+ <Input readOnly={true} value={currentApp?.name || currentApp?.appKey || ''} />
91
+ </div>
92
92
 
93
- <div>
94
- <Checkbox
95
- label="Is Shared"
96
- checked={state.isShared}
97
- onChange={(event: ChangeEvent<HTMLInputElement>) => {
98
- setState((s) => ({ ...s, isShared: event.target.checked }));
99
- }}
100
- />
101
- </div>
102
- </StyledContent>
103
- <Dialog.Actions>
104
- <div style={{ display: 'flex', gap: '0.2em' }}>
105
- <Button onClick={() => onClose(false)} variant="ghost">
106
- Cancel
107
- </Button>
108
- <Button
109
- disabled={!currentApp || !state.name}
110
- onClick={() => {
111
- createBookmark(state);
112
- }}
113
- >
114
- Create
115
- </Button>
116
- </div>
117
- </Dialog.Actions>
118
- </Dialog>
119
- );
93
+ <div>
94
+ <Checkbox
95
+ label="Is Shared"
96
+ checked={state.isShared}
97
+ onChange={(event: ChangeEvent<HTMLInputElement>) => {
98
+ setState((s) => ({ ...s, isShared: event.target.checked }));
99
+ }}
100
+ />
101
+ </div>
102
+ </StyledContent>
103
+ <Dialog.Actions>
104
+ <div style={{ display: 'flex', gap: '0.2em' }}>
105
+ <Button onClick={() => onClose(false)} variant="ghost">
106
+ Cancel
107
+ </Button>
108
+ <Button
109
+ disabled={!currentApp || !state.name}
110
+ onClick={() => {
111
+ createBookmark(state);
112
+ }}
113
+ >
114
+ Create
115
+ </Button>
116
+ </div>
117
+ </Dialog.Actions>
118
+ </Dialog>
119
+ );
120
120
  };