|
1 | 1 | import { Button } from '@openfun/cunningham-react';
|
2 | 2 | import React from 'react';
|
| 3 | +import styled from 'styled-components'; |
3 | 4 |
|
4 |
| -import { Box, Text } from '@/components'; |
| 5 | +import { Box, Icon, Text } from '@/components'; |
5 | 6 | import { DatabaseSourceSelector } from '@/docs/doc-editor/components/DatabaseSourceSelector';
|
6 | 7 | import { useGristCreateDocAndTable } from '@/features/grist/useGristCreateTable';
|
7 | 8 |
|
@@ -32,20 +33,89 @@ export const DatabaseSelector = ({
|
32 | 33 | };
|
33 | 34 |
|
34 | 35 | return (
|
35 |
| - <Box |
36 |
| - style={{ |
37 |
| - flexDirection: 'column', |
38 |
| - gap: 10, |
39 |
| - alignItems: 'center', |
40 |
| - justifyContent: 'center', |
41 |
| - width: '100%', |
42 |
| - }} |
43 |
| - > |
44 |
| - <Button onClick={handleCreateNewDatabase}> |
45 |
| - Créer une nouvelle base de données vide |
46 |
| - </Button> |
47 |
| - <Text>ou</Text> |
48 |
| - <DatabaseSourceSelector onSourceSelected={onDatabaseSelected} /> |
49 |
| - </Box> |
| 36 | + <Wrapper> |
| 37 | + <Box |
| 38 | + style={{ |
| 39 | + width: 40, |
| 40 | + height: 40, |
| 41 | + borderRadius: 20, |
| 42 | + alignItems: 'center', |
| 43 | + justifyContent: 'center', |
| 44 | + backgroundColor: 'rgb(133, 184, 255)', |
| 45 | + }} |
| 46 | + > |
| 47 | + <Icon iconName="storage" color="rgb(62, 152, 255)" /> |
| 48 | + </Box> |
| 49 | + <Title>Source de données</Title> |
| 50 | + <Description>Choisissez votre méthode de création</Description> |
| 51 | + <OptionsWrapper> |
| 52 | + <Option> |
| 53 | + <Box |
| 54 | + style={{ flexDirection: 'row', justifyContent: 'space-between' }} |
| 55 | + > |
| 56 | + <Box> |
| 57 | + <OptionTitle>Créer une nouvelle base de données vide</OptionTitle> |
| 58 | + <Description> |
| 59 | + Partir d'une base de données vierge |
| 60 | + </Description> |
| 61 | + </Box> |
| 62 | + <Button |
| 63 | + onClick={handleCreateNewDatabase} |
| 64 | + icon={<Icon iconName="add" $color="white" />} |
| 65 | + ></Button> |
| 66 | + </Box> |
| 67 | + </Option> |
| 68 | + <Text style={{ fontWeight: 600, fontSize: 14 }}>ou</Text> |
| 69 | + <Option> |
| 70 | + <Box style={{ marginBottom: 10 }}> |
| 71 | + <OptionTitle> |
| 72 | + Sélectionner une base de données existante |
| 73 | + </OptionTitle> |
| 74 | + <Description> |
| 75 | + Connecter une base de données Grist déjà créée |
| 76 | + </Description> |
| 77 | + </Box> |
| 78 | + <DatabaseSourceSelector onSourceSelected={onDatabaseSelected} /> |
| 79 | + </Option> |
| 80 | + </OptionsWrapper> |
| 81 | + </Wrapper> |
50 | 82 | );
|
51 | 83 | };
|
| 84 | + |
| 85 | +const Wrapper = styled(Box)` |
| 86 | + border: 2px solid rgb(160, 207, 255); |
| 87 | + background-color: rgb(230, 243, 255); |
| 88 | + border-radius: 4px; |
| 89 | + width: 100%; |
| 90 | + padding: 16px; |
| 91 | + align-items: center; |
| 92 | + gap: 10px; |
| 93 | +`; |
| 94 | + |
| 95 | +const Title = styled(Text)` |
| 96 | + font-weight: 800; |
| 97 | + font-size: 18px; |
| 98 | +`; |
| 99 | + |
| 100 | +const Description = styled(Text)` |
| 101 | + color: rgb(110, 110, 110); |
| 102 | + font-size: 14px; |
| 103 | +`; |
| 104 | + |
| 105 | +const OptionTitle = styled(Text)` |
| 106 | + font-weight: 600; |
| 107 | + font-size: 14px; |
| 108 | +`; |
| 109 | + |
| 110 | +const Option = styled(Box)` |
| 111 | + width: 100%; |
| 112 | + border: 1px solid rgb(180, 180, 180); |
| 113 | + border-radius: 4px; |
| 114 | + padding: 8px 16px; |
| 115 | +`; |
| 116 | + |
| 117 | +const OptionsWrapper = styled(Box)` |
| 118 | + width: 100%; |
| 119 | + gap: 5px; |
| 120 | + align-items: center; |
| 121 | +`; |
0 commit comments