Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
Regex elscooterens beskrivelse
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom9521 authored and Thom9521 committed Jan 6, 2020
1 parent 01fa344 commit 9fd4b4e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
8 changes: 5 additions & 3 deletions src/components/addNewScooter/AddNewScooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,12 @@ function AddNewScooter() {
name="description"
id="scooterDescription"
minLength="1"
maxLength="200"
value={description}
maxLength="500"
default={description}
placeholder="Beskrivelse..."
onChange={event => setDescription(event.target.value)}
onChange={event =>
setDescription(event.target.value.replace(/\r?\n/g, '<br>'))
}
/>
<InputGroupAddon
addonType="append"
Expand Down
37 changes: 18 additions & 19 deletions src/components/editScooter/EditScooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,23 @@ function EditScooter(props) {
const imageUrl =
'https://tukka.fra1.digitaloceanspaces.com/' + blob.name;
setImagePath(imageUrl);
updateScooterById({
variables: {
name: name,
price: price,
sku: sku,
tags: tags,
brand: brand,
description: description,
itemNo: itemNo,
imagePath: imagePath
}
});
// Sæt 'alertStatus' til at være true (så den vises)
setAlertStatus(true);
}
});
}
updateScooterById({
variables: {
name: name,
price: price,
sku: sku,
tags: tags,
brand: brand,
description: description,
itemNo: itemNo,
imagePath: imagePath
}
});
// Sæt 'alertStatus' til at være true (så den vises)
setAlertStatus(true);
}
};

Expand Down Expand Up @@ -253,7 +253,6 @@ function EditScooter(props) {
<FormGroup>
<InputGroup>
<Input
required
className="inputStyles"
type="text"
name="itemNo"
Expand Down Expand Up @@ -294,7 +293,6 @@ function EditScooter(props) {
<FormGroup>
<InputGroup>
<Input
required
className="inputStyles"
type="text"
name="name"
Expand Down Expand Up @@ -504,9 +502,11 @@ function EditScooter(props) {
id="scooterDescription"
minLength="1"
maxLength="200"
defaultValue={description}
defaultValue={description.replace(/<br ?\/?>/g, '\n')}
placeholder="Beskrivelse..."
onChange={event => setDescription(event.target.value)}
onChange={event =>
setDescription(event.target.value.replace(/\r?\n/g, '<br>'))
}
/>
<InputGroupAddon
addonType="append"
Expand Down Expand Up @@ -539,7 +539,6 @@ function EditScooter(props) {
<FormGroup>
<InputGroup>
<Input
required
className="inputStyles p-2"
type="file"
id="scooterImagePath"
Expand Down

0 comments on commit 9fd4b4e

Please sign in to comment.