forked from b00tc4mp/isdi-parttime-202403
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add view and logic to do execericises b00tc4mp#182
- Loading branch information
1 parent
b64af8e
commit b1cc548
Showing
9 changed files
with
136 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
staff/agustin-birman/app/src/components/core/Button/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import './index.css' | ||
|
||
function Button({ type, className, onClick, children }) { | ||
return <button className={`Button ${className ? className : ''}`} type={type} onClick={onClick}>{children}</button> | ||
function Button({ type, className, onClick, children, disabled }) { | ||
return <button className={`Button ${className ? className : ''}`} type={type} onClick={onClick} disabled={disabled}>{children} </button> | ||
} | ||
|
||
export default Button |
13 changes: 11 additions & 2 deletions
13
staff/agustin-birman/app/src/components/core/Input/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import './index.css' | ||
|
||
function Input({ id, type, name, placeholder, value, checked, onChange }) { | ||
return <input className='Input' id={id} type={type} name={name} placeholder={placeholder} value={value} checked={checked} onChange={onChange} /> | ||
function Input({ id, type, name, placeholder, value, checked, onChange, className, required }) { | ||
return <input | ||
className={`Input ${className ? className : ''}`} | ||
id={id} | ||
type={type} | ||
name={name} | ||
placeholder={placeholder} | ||
value={value} | ||
checked={checked} | ||
onChange={onChange} | ||
required={required} /> | ||
} | ||
|
||
export default Input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import errors, { SystemError } from "com/errors" | ||
import validate from "com/validate" | ||
|
||
const submitAnswer = (exerciseId, answer) => { | ||
validate.id(exerciseId, 'exerciseId') | ||
validate.text(answer, 'answer') | ||
|
||
return fetch(`${import.meta.env.VITE_API_URL}/answer`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: `Bearer ${sessionStorage.token}`, | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ exerciseId, answer }) | ||
}) | ||
.catch(() => { throw new SystemError('server error') }) | ||
.then(response => { | ||
if (response.status === 201) | ||
return | ||
|
||
return response.json() | ||
.catch(() => { throw new SystemError('server error') }) | ||
.then(body => { | ||
const { error, message } = body | ||
|
||
const constructor = errors[error] | ||
|
||
throw new constructor(message) | ||
}) | ||
}) | ||
} | ||
export default submitAnswer |
9 changes: 9 additions & 0 deletions
9
staff/agustin-birman/app/src/views/components/DoActivity/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.ExerciseContainer{ | ||
display:inline-flex; | ||
align-items: center; | ||
white-space: nowrap; | ||
} | ||
|
||
.ExerciseInput{ | ||
width: 6rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters