From 4309615b878c0e355c63240b85a913b3ca363790 Mon Sep 17 00:00:00 2001 From: MelFonk Date: Tue, 26 Nov 2024 17:48:16 +0100 Subject: [PATCH] comment breadcrumb --- .../outils/csv/components/holder.styles.tsx | 80 +++++++++++ src/app/outils/csv/components/holder.tsx | 127 ++++------------- src/app/outils/csv/page.styles.tsx | 33 +++-- src/app/outils/csv/page.tsx | 129 +++++++++--------- 4 files changed, 194 insertions(+), 175 deletions(-) create mode 100644 src/app/outils/csv/components/holder.styles.tsx diff --git a/src/app/outils/csv/components/holder.styles.tsx b/src/app/outils/csv/components/holder.styles.tsx new file mode 100644 index 000000000..55e826bb0 --- /dev/null +++ b/src/app/outils/csv/components/holder.styles.tsx @@ -0,0 +1,80 @@ +'use client' + +import styled from 'styled-components' +import theme from '@/theme' + +export const HolderWrapper = styled.div` + + .dropzone { + display: flex; + flex-flow: column; + justify-content: center; + width: 100%; + border: 1px dashed #ccc; + height: 200px; + text-align: center; + cursor: pointer; + border-radius: 4px; + } + + .dropzone:hover { + background-color: #ebeff3; + } + + .dropzone.file { + display: flex; + flex-flow: column; + height: auto; + border: none; + } + + .file-container { + width: 100%; + } + + .file-sumup { + display: flex; + align-items: center; + justify-content: space-between; + text-align: left; + } + + .file-details { + display: flex; + align-items: center; + } + + .file-infos { + border-left: 3px solid ${theme.colors.primary.border}; + margin-left: 5px; + padding: 0 5px; + } + + .name { + font-weight: bolder; + } + + .size { + font-style: italic; + font-size: 14px; + } + + .active { + background-color: #ebeff3; + } + + .loading { + display: flex; + align-items: center; + justify-content: space-between; + font-style: italic; + } + .loading span { + margin-left: 1em; + } + + span > .fr-icon-refresh-fill { + margin-right: 10px; + color: var(--blue-france-sun-113-625); + } + ` diff --git a/src/app/outils/csv/components/holder.tsx b/src/app/outils/csv/components/holder.tsx index 762e8b35b..a96620311 100644 --- a/src/app/outils/csv/components/holder.tsx +++ b/src/app/outils/csv/components/holder.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import Dropzone from 'react-dropzone' import Loader from '@/components/Loader/index' -import theme from '@/theme/theme' +import { HolderWrapper } from './holder.styles' function formatFileSize(bytes: number) { if (bytes === 0) { @@ -34,106 +34,37 @@ export default function Holder({ file = null, placeholder, isLoading = false, on const inputProps = getInputProps() return ( -
setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} - > - -
{!file &&

Glisser le fichier

}
-
{file - ? ( -
-
-
-
{file.name}
-
{formatFileSize(file.size)}
+ +
setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} + > + +
{!file &&

Glisser le fichier

}
+
{file + ? ( +
+
+
+
{file.name}
+
{formatFileSize(file.size)}
+
+ {isLoading + ? ( +
Chargement du fichier…
+ ) + : ( +
- {isLoading - ? ( -
Chargement du fichier…
- ) - : ( -

React-Feather Icon

- )} -
- ) - : placeholder} + ) + : placeholder} +
- - -
+ ) }} diff --git a/src/app/outils/csv/page.styles.tsx b/src/app/outils/csv/page.styles.tsx index d2478742b..a40404a6d 100644 --- a/src/app/outils/csv/page.styles.tsx +++ b/src/app/outils/csv/page.styles.tsx @@ -1,16 +1,21 @@ -// +export const TextWrapper = styled.div` + + .filters { + margin: 1em 0; + } + + .loading { + display: flex; + flex-direction: column; + align-items: center; + margin: 1em 0; + } + + .error { + color: red; + } + ` diff --git a/src/app/outils/csv/page.tsx b/src/app/outils/csv/page.tsx index 1256913e6..21d8e8f8d 100644 --- a/src/app/outils/csv/page.tsx +++ b/src/app/outils/csv/page.tsx @@ -14,6 +14,7 @@ import Holder from './components/holder' import Table from './components/table' import Geocoder from './components/geocoder' import Loader from '@/components/Loader/index' +import { TextWrapper } from './page.styles' const allowedTypes = new Set([ 'text/plain', @@ -133,7 +134,7 @@ export default function Csv() { const columns = csv ? csv.data[0] : [] return ( <> - + /> */}
-
-
-

1. Choisir un fichier

- - - - {loading && ( -
-

Analyse du fichier en cours…

- -
- )} + +
+
+

1. Choisir un fichier

+ + + + {loading && ( +
+

Analyse du fichier en cours…

+ +
+ )} - {error &&
{error.message}
} -
+ {error &&
{error.message}
} +
+ +
+
+ + {csv && } + + -
-
- - {csv &&
} + + {csv && ( + + )} - - {csv && ( - - )} - - - {csv && ( - <> -
- - - {advancedPanel && ( - +
+ + + {advancedPanel && ( + + )} +
+ {file + && ( + )} -
- {file - && ( - - )} - - )} + + )} + - +