code7-leia 1.0.13 → 1.0.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code7-leia",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "author": "code7-xlab",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.es.js",
@@ -18,7 +18,8 @@
18
18
  "scripts": {
19
19
  "dev": "vite",
20
20
  "build": "vite build",
21
- "deploy": "npm run build && npm version patch && npm publish"
21
+ "deploy": "npm run build && npm version patch && npm publish",
22
+ "deploy-gio": "npm run build && npm publish"
22
23
  },
23
24
  "dependencies": {
24
25
  "axios": "^1.6.7",
@@ -79,3 +79,7 @@ export const Container = styled.div<ContainerProps>`
79
79
  }
80
80
  }
81
81
  `;
82
+
83
+ const Table = styled.table`
84
+ margin-top: 12px;
85
+ `
@@ -10,6 +10,7 @@ import LengthCounter from '../LengthCounter';
10
10
  import { useLeia } from '../../contexts/LeiaProvider';
11
11
 
12
12
  import * as S from './styles';
13
+ import Table from '../FileArea/components/Table';
13
14
 
14
15
  interface Persona {
15
16
  id: number;
@@ -105,7 +106,7 @@ export const PersonasArea = () => {
105
106
  return (
106
107
  <S.Container>
107
108
  <S.Header>
108
- <div>
109
+ <div className='infos'>
109
110
  <h2>{t.personas?.title}</h2>
110
111
  <p>{t.personas?.description}</p>
111
112
  </div>
@@ -113,19 +114,22 @@ export const PersonasArea = () => {
113
114
  <FaPlus /> {t.personas?.add}
114
115
  </button>
115
116
  </S.Header>
116
- <Search placeholder={t.search} setFiles={setPersonas} initialFiles={personas} />
117
- <S.List>
118
- {filteredPersonas?.map((persona: any) => (
119
- <S.Row key={persona.id}>
120
- <div className="info">
121
- <strong>{persona.name}</strong>
122
- <span>{persona.description}</span>
123
- </div>
124
- {/**
125
- * Se tiver o created_at, significa que é uma persona criada pelo usuário
126
- * e pode ser editada ou clonada. Caso contrário, é uma persona padrão e não pode ser editada.
127
- */}
128
- {persona.created_at && (
117
+ <S.Search>
118
+ <Search placeholder={t.search} setFiles={setPersonas} initialFiles={personas} />
119
+ </S.Search>
120
+ <S.TableContainer>
121
+ <tbody>
122
+ {filteredPersonas?.map((persona: any) => (
123
+
124
+ <tr className = "tr-Row" key = {persona.id}>
125
+ <td>
126
+ <div className="info">
127
+ <p><strong>{persona.name}</strong></p>
128
+ <span>{persona.description}</span>
129
+ </div>
130
+ </td>
131
+ <td className='td-actions'>
132
+ {persona.created_at && (
129
133
  <div className="actions">
130
134
  <button onClick={() => openEdit(persona)}>
131
135
  <FaEdit /> {t.edit}
@@ -133,15 +137,19 @@ export const PersonasArea = () => {
133
137
  <button onClick={() => openClone(persona)}>
134
138
  <FaCopy /> {t.clone}
135
139
  </button>
136
- <button onClick={() => openDelete(persona)}>
140
+ <button className="button-delete" onClick={() => openDelete(persona)}>
137
141
  <FaTrash /> {t.delete}
138
142
  </button>
139
143
  </div>
140
144
  )}
145
+ </td>
146
+ </tr>
147
+
141
148
 
142
- </S.Row>
143
- ))}
144
- </S.List>
149
+ ))}
150
+ </tbody>
151
+ </S.TableContainer>
152
+
145
153
 
146
154
  {isOpen && (
147
155
  <Modal onClose={() => setIsOpen(false)} title={t.personas?.modalTitle}>
@@ -150,11 +158,13 @@ export const PersonasArea = () => {
150
158
  value={form.name}
151
159
  placeholder={t.personas?.fields.name}
152
160
  onChange={(value: any) => setForm({ ...form, name: value })}
161
+ maxLength={50}
153
162
  />
154
163
  <Input
155
164
  value={form.description}
156
165
  placeholder={t.personas?.fields.description}
157
166
  onChange={(value: any) => setForm({ ...form, description: value })}
167
+ maxLength={200}
158
168
  />
159
169
  </S.InputWrapper>
160
170
  <TextArea
@@ -18,7 +18,6 @@ export const Header = styled.div`
18
18
 
19
19
  h2 {
20
20
  font-size: 20px;
21
- margin: 0;
22
21
  }
23
22
 
24
23
  p {
@@ -48,7 +47,7 @@ export const Header = styled.div`
48
47
 
49
48
  export const Search = styled.div`
50
49
  width: 320px;
51
- margin-bottom: 15px;
50
+ margin-bottom: 12px;
52
51
  `;
53
52
 
54
53
  export const List = styled.div`
@@ -87,7 +86,7 @@ export const Row = styled.div`
87
86
  gap: 8px;
88
87
 
89
88
  button {
90
- background: white;
89
+ background: red;
91
90
  border: 1px solid #dcdfe6;
92
91
  padding: 6px 10px;
93
92
  border-radius: 4px;
@@ -135,3 +134,72 @@ export const InputWrapper = styled.div`
135
134
  margin-bottom: 12px;
136
135
  max-width: 100%;
137
136
  `;
137
+
138
+ export const TableContainer = styled.table`
139
+
140
+ .tr-Row {
141
+ display: flex;
142
+ justify-content: space-between;
143
+ align-items: center;
144
+
145
+ background: white;
146
+ padding: 14px;
147
+ border-radius: 5px;
148
+ border: 1px solid #dcdfe6;
149
+ margin-bottom: 2px;
150
+
151
+ .info {
152
+ display: flex;
153
+ flex-direction: column;
154
+
155
+ strong {
156
+ font-size: 14px;
157
+ }
158
+
159
+ span {
160
+ font-size: 13px;
161
+ color: #5a5d68;
162
+ margin-top: 2px;
163
+ }
164
+ }
165
+
166
+ .actions {
167
+ display: flex;
168
+ gap: 8px;
169
+
170
+ button {
171
+ background: #f3f5f9;
172
+ cursor: pointer;
173
+ border: 1px solid #dcdfe6;
174
+ padding: 8px 12px;
175
+ border-radius: 4px;
176
+ color: rgb(16, 38, 147);
177
+
178
+ display: flex;
179
+ align-items: center;
180
+ gap: 6px;
181
+
182
+ font-size: 12px;
183
+
184
+ svg {
185
+ width: 12px;
186
+ height: 12px;
187
+ }
188
+
189
+ &:hover {
190
+ background: #dadce3;
191
+ }
192
+ }
193
+
194
+ .button-delete {
195
+ background: #fae0d2;
196
+ border: 1px solid #f5c2c2;
197
+ color: #5b0a1f;
198
+
199
+ &:hover {
200
+ background: #f5bba7;
201
+ }
202
+ }
203
+ }
204
+ }
205
+ `;
@@ -1,20 +1,21 @@
1
1
  import React from 'react';
2
2
  import * as S from './styles';
3
3
 
4
- interface InputTestProps {
5
- placeholder: string;
4
+ interface InputTestProps
5
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
6
6
  onChange: (value: string) => void;
7
- value?: string;
8
7
  }
9
8
 
10
- const InputTest: React.FC<InputTestProps> = ({ placeholder, onChange, value }) => {
9
+
10
+ const InputTest: React.FC<InputTestProps> = ({
11
+ onChange,
12
+ ...rest
13
+ }) => {
11
14
  return (
12
15
  <S.Container>
13
16
  <S.StyledInput
14
- type="text"
15
- value={value}
16
- onChange={(e: any) => onChange(e.target.value)}
17
- placeholder={placeholder}
17
+ {...rest}
18
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => onChange(e.target.value)}
18
19
  />
19
20
  </S.Container>
20
21
  );
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
 
3
3
  export const API_TOKEN = 'API_TOKEN';
4
4
 
5
- const url = 'http://localhost:5000';
5
+ const url = 'https://api-hml.leia.digitalcontact.cloud'
6
6
 
7
7
  axios.defaults.baseURL = `${url}`;
8
8
 
@@ -8,6 +8,7 @@ export const enTranslation: Language = {
8
8
  edit: 'Edit',
9
9
  clone: 'Clone',
10
10
  save: 'Save',
11
+ delete: 'Delete',
11
12
  copyPrefix: 'Copy',
12
13
 
13
14
  personas: {
@@ -7,6 +7,7 @@ export const esTranslation: Language = {
7
7
  search: 'Buscar',
8
8
  edit: 'Editar',
9
9
  clone: 'Clonar',
10
+ delete: 'Borrar',
10
11
  save: 'Guardar',
11
12
  copyPrefix: 'Copia',
12
13
 
@@ -7,6 +7,7 @@ export const ptTranslation: Language = {
7
7
  search: 'Pesquisar',
8
8
  edit: 'Editar',
9
9
  clone: 'Clonar',
10
+ delete: 'Excluir',
10
11
  save: 'Salvar',
11
12
  copyPrefix: 'Cópia',
12
13