|
1 | 1 | /* eslint-disable react-hooks/rules-of-hooks */
|
2 | 2 | import { insertOrUpdateBlock } from '@blocknote/core';
|
3 | 3 | import { createReactBlockSpec } from '@blocknote/react';
|
4 |
| -import { Button, Input } from '@openfun/cunningham-react'; |
| 4 | +import { Button } from '@openfun/cunningham-react'; |
5 | 5 | import { ColDef } from 'ag-grid-community';
|
6 | 6 | import { AgGridReact } from 'ag-grid-react';
|
7 | 7 | import { TFunction } from 'i18next';
|
8 | 8 | import React, { useRef, useState } from 'react';
|
9 | 9 |
|
10 |
| -import { Box, DropButton, Icon, Text } from '@/components'; |
| 10 | +import { Box, Icon } from '@/components'; |
11 | 11 |
|
12 | 12 | import { DocsBlockNoteEditor } from '../../types';
|
13 | 13 | import { DatabaseSourceSelector } from '../DatabaseSourceSelector';
|
14 | 14 | import { DatabaseTableDisplay } from '../DatabaseTableDisplay';
|
15 | 15 |
|
| 16 | +import { AddButtonComponent } from './DatabaseBlock/AddColumnButton'; |
| 17 | + |
16 | 18 | export const DatabaseBlock = createReactBlockSpec(
|
17 | 19 | {
|
18 | 20 | type: 'database',
|
@@ -40,52 +42,6 @@ export const DatabaseBlock = createReactBlockSpec(
|
40 | 42 | { make: 'Toyota', model: 'Corolla', price: 29600, electric: false },
|
41 | 43 | ];
|
42 | 44 |
|
43 |
| - const AddButtonComponent = ({ |
44 |
| - isOpen, |
45 |
| - setIsOpen, |
46 |
| - }: { |
47 |
| - isOpen: boolean; |
48 |
| - setIsOpen: (open: boolean) => void; |
49 |
| - }) => { |
50 |
| - const onOpenChange = (isOpen: boolean) => { |
51 |
| - setIsOpen(isOpen); |
52 |
| - }; |
53 |
| - |
54 |
| - return ( |
55 |
| - <DropButton |
56 |
| - isOpen={isOpen} |
57 |
| - onOpenChange={onOpenChange} |
58 |
| - label="add column" |
59 |
| - button={ |
60 |
| - <Box style={{ padding: '0.25rem', gap: '16px' }} color="tertiary"> |
61 |
| - <span className="material-icons">add</span> |
62 |
| - </Box> |
63 |
| - } |
64 |
| - > |
65 |
| - <Box style={{ padding: '10px', gap: '10px' }}> |
66 |
| - <Text |
67 |
| - $variation="600" |
68 |
| - $size="s" |
69 |
| - $weight="bold" |
70 |
| - $theme="greyscale" |
71 |
| - > |
72 |
| - Ajouter une colonne |
73 |
| - </Text> |
74 |
| - <Input label="Column label"></Input> |
75 |
| - <Button |
76 |
| - size="small" |
77 |
| - onClick={() => { |
78 |
| - setIsOpen(false); |
79 |
| - }} |
80 |
| - style={{ alignSelf: 'end', width: 'fit-content' }} |
81 |
| - > |
82 |
| - Valider |
83 |
| - </Button> |
84 |
| - </Box> |
85 |
| - </DropButton> |
86 |
| - ); |
87 |
| - }; |
88 |
| - |
89 | 45 | // Column Definitions: Defines the columns to be displayed.
|
90 | 46 | const colDefs: ColDef[] = [
|
91 | 47 | { field: 'make', sort: 'desc' },
|
|
0 commit comments