Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: proposed input file #151

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fa3f4f5
ci: se agrega la rama dev al workflow
alan199912 Mar 6, 2023
696dbcf
fix: se corrige espaciado de icono en boton (#136)
victorianastasi Mar 13, 2023
bbcd007
feat: tooltip (#137)
Jesus1397 Mar 13, 2023
edf59ff
fix: se modifica visualizacion de breadcrumb en storybook, se reempla…
victorianastasi Mar 28, 2023
369da51
feat: alert dismissible (#135)
alan199912 Mar 29, 2023
0ec710f
fix: pagination (#141)
victorianastasi Mar 31, 2023
e991777
Merge branch 'master' into dev
lautarorodriguez96 Apr 4, 2023
bc5e398
feat: Alerta - Tooltip - Paginador - Breadcrumb
lautarorodriguez96 Apr 4, 2023
e4015d7
fix: version actual de manera dinamica
alan199912 Apr 10, 2023
a853d58
feat: navegacion por pestañas (#138)
davisLjr Apr 14, 2023
8c7f677
fix: se modifican nombres, se reemplaza textos secundarios por epigra…
victorianastasi Apr 14, 2023
e014658
Merge branch 'master' dev
lautarorodriguez96 Apr 20, 2023
7b26553
fix: spinner y boton con spinner (#142)
victorianastasi Apr 21, 2023
243573c
fix: barra de progreso (#146)
Jesus1397 Apr 21, 2023
752c852
fix: accesos (#134)
matilope Apr 24, 2023
3abb2f8
fix: se genera propuesta para el componente adjuntar archivo
davisLjr Apr 24, 2023
05c7cc1
fix: se formatea el archivo
davisLjr Apr 25, 2023
4bc7450
fix: se cambian nombres de español a ingles
davisLjr Apr 25, 2023
b994f93
fix: se elimina variable de texto
davisLjr Apr 25, 2023
e94f039
fix: se elimina clase container dentro del contenido
davisLjr Apr 25, 2023
8b65b18
fix: se elimina clase label
davisLjr Apr 25, 2023
1d56139
fix: se elimina props label
davisLjr Apr 25, 2023
f2ba95a
fix: se agregan nuevos espaciados segun comentarios en pr
davisLjr Apr 25, 2023
abc6d5f
fix: se elimina el interface
davisLjr Apr 25, 2023
396a04c
fix: Merge branch 'master' into fix_proposed_input_file
davisLjr May 8, 2023
e332963
fix: actualizacion de componente maquetado y estilos
davisLjr May 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 49 additions & 6 deletions src/form/File.stories.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consultaria sobre el tipo de archivo permitido y el tamaño maximo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falta detallar

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Base
import React from 'react';
import React, { useState } from 'react';
import './Form.stories.scss';

// Addons
Expand All @@ -11,13 +11,56 @@ export default {
decorators: [withA11y]
};

export const SubirUnArchivo = (): JSX.Element => {
interface SubirUnArchivoProps {
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
label: string;
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
onFileSelect: (file: File) => void;
}

export const SubirUnArchivo = ({ label, onFileSelect }: SubirUnArchivoProps): JSX.Element => {
const [file, setFile] = useState<File | null>(null);
const [inputKey, setInputKey] = useState<number>(0);

const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
if (file) {
setFile(file);
onFileSelect(file);
}
};

const handleDeleteFile = () => {
setFile(null);
setInputKey((prevKey) => prevKey + 1); // Incrementa el key para renderizar un nuevo input
};

label = 'Arrastrá tus archivos acá o hace click para adjuntar';
davisLjr marked this conversation as resolved.
Show resolved Hide resolved

return (
<div className="form-wrapper">
<div className="form-group">
<label htmlFor="file-input">Adjuntar un archivo de ejemplo</label>
<input type="file" className="form-control-file" id="file-input" />
<div className="form-wrapper-lg">
<div className="file-group bg-light">
<i className="bx bx-cloud-upload"></i>
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
<label htmlFor="file-input" className="label">
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
{label}
</label>
<input
key={inputKey} // Añade un key único para que React cree un nuevo input
type="file"
className="form-control-file bg-light custom-file"
id="file-input"
onChange={handleFileUpload}
/>
</div>
{file && (
<div className="filename-container">
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
<label>
<i className="bx bx-file"></i>
{file.name.length > 20 ? `${file.name.slice(0, 20)}...` : file.name}
</label>
<button type="button" className="btn btn-outline-danger btn-sm" onClick={handleDeleteFile}>
Eliminar
</button>
</div>
)}
</div>
);
};
Expand Down
5 changes: 5 additions & 0 deletions src/form/Form.stories.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.form-wrapper {
width: 400px;
}

.form-wrapper-lg {
max-width: 600px;
width: 100%;
}
64 changes: 64 additions & 0 deletions src/scss/components/_form.scss
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,70 @@ $form-validation-states: (
}
}

.file-group {
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
position: relative;
min-height: 120px;
width: 100%;
color: $blue;
border-style: dashed;
border-width: 2px;
border-color: $grisulado-100;

davisLjr marked this conversation as resolved.
Show resolved Hide resolved
i, span{
position: absolute;
top: 42%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 2.5rem;

@media (max-width: 460px) {
top: 33%;
}
}

.label {
position: absolute;
top: 65%;
left: 50%;
transform: translate(-50%, -50%);
davisLjr marked this conversation as resolved.
Show resolved Hide resolved
text-align: center;
width: 100%;
padding: 0 0.5rem;
}

.custom-file {
height: 100%;
width: 100%;
opacity: 0;
position: absolute;
top: 0;
left: 0;
z-index: 9;
}
}

.filename-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1.25rem;
davisLjr marked this conversation as resolved.
Show resolved Hide resolved

label {
display: flex;
align-items: center;
margin-left: 10px;
color: $blue;
margin-bottom: 0px;

i,span {
font-size: 2rem;
margin-right: 5px;
color: $grisulado-900;
}
}
}


.custom-control-label {
padding: spaceUnits(1);
padding-left: $custom-control-indicator-size + spaceUnits(5);
Expand Down