-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from vietredweb/Issue-298
fixes #298 Fix Image, Youtube Field layout
- Loading branch information
Showing
24 changed files
with
431 additions
and
26 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
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,88 @@ | ||
/* | ||
* @copyright Copyright (C) 2022 AesirX. All rights reserved. | ||
* @license GNU General Public License version 3, see LICENSE. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { Button, Col, Row } from 'react-bootstrap'; | ||
import './index.scss'; | ||
import { withTranslation } from 'react-i18next'; | ||
import Input from '../Input'; | ||
import { SVGComponent } from 'aesirx-uikit'; | ||
const FormUrl = ({ field, ...props }) => { | ||
const { t } = props; | ||
const [listOptions, setListOptions] = useState( | ||
field?.getValueSelected?.length ? field?.getValueSelected : [{ url: '', title: '' }] | ||
); | ||
return ( | ||
<> | ||
{listOptions?.map((option, index) => { | ||
return ( | ||
<div key={`${index}`} className="position-relative"> | ||
<Row className="mt-16 gx-24"> | ||
<Col xs={4}> | ||
<Input | ||
key={index + option?.url} | ||
field={{ | ||
key: index + option?.url, | ||
getValueSelected: option?.url, | ||
classNameInput: 'fs-14', | ||
placeholder: 'Url', | ||
handleChange: (data) => { | ||
listOptions[index] = { ...listOptions[index], url: data.target.value }; | ||
setListOptions(listOptions); | ||
field.handleChange(listOptions); | ||
}, | ||
}} | ||
/> | ||
</Col> | ||
<Col xs={8}> | ||
<div className="d-flex"> | ||
<div className="w-100"> | ||
<Input | ||
key={index + option?.title} | ||
field={{ | ||
key: index + option?.title, | ||
getValueSelected: option?.title, | ||
classNameInput: 'fs-14', | ||
placeholder: 'Title', | ||
handleChange: (data) => { | ||
listOptions[index] = { ...listOptions[index], title: data.target.value }; | ||
setListOptions(listOptions); | ||
field.handleChange(listOptions); | ||
}, | ||
}} | ||
/> | ||
</div> | ||
<div | ||
className="border-1 rounded-1 d-flex align-items-center justify-content-center ms-24 px-8px cursor-pointer" | ||
onClick={() => { | ||
let array = [...listOptions]; | ||
array.splice(index, 1); | ||
setListOptions(array); | ||
field.handleChange(array); | ||
}} | ||
> | ||
<SVGComponent url="/assets/images/cancel.svg" className={'bg-danger'} /> | ||
</div> | ||
</div> | ||
</Col> | ||
</Row> | ||
</div> | ||
); | ||
})} | ||
<Button | ||
variant={`light`} | ||
className={`px-24 py-10 fw-semibold d-flex align-items-center rounded-1 border border-success border-da-1 mt-16`} | ||
onClick={() => { | ||
setListOptions([...listOptions, { url: '', title: '' }]); | ||
}} | ||
> | ||
<SVGComponent url="/assets/images/plus.svg" className={`me-15`} /> | ||
{t('txt_add')} | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
export default withTranslation()(FormUrl); |
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,15 @@ | ||
/* | ||
* @copyright Copyright (C) 2022 AesirX. All rights reserved. | ||
* @license GNU General Public License version 3, see LICENSE. | ||
*/ | ||
|
||
@import '../../../scss/utils/bootstrap.scss'; | ||
|
||
.input-format { | ||
position: absolute; | ||
top: 1px; | ||
right: 0; | ||
width: 60px; | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
} |
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,72 @@ | ||
/* | ||
* @copyright Copyright (C) 2022 AesirX. All rights reserved. | ||
* @license GNU General Public License version 3, see LICENSE. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { Button, Col, Row } from 'react-bootstrap'; | ||
import './index.scss'; | ||
import { withTranslation } from 'react-i18next'; | ||
import Input from '../Input'; | ||
import { SVGComponent } from 'aesirx-uikit'; | ||
const FormYoutube = ({ field, ...props }) => { | ||
const { t } = props; | ||
const [listOptions, setListOptions] = useState( | ||
field?.getValueSelected?.length ? field?.getValueSelected : [''] | ||
); | ||
return ( | ||
<> | ||
{listOptions?.map((option, index) => { | ||
return ( | ||
<div key={`${index}`} className="position-relative"> | ||
<Row className="mt-16 gx-24"> | ||
<Col xs={12}> | ||
<div className="d-flex"> | ||
<div className="w-100"> | ||
<Input | ||
key={index + option?.value} | ||
field={{ | ||
key: index + option?.value, | ||
getValueSelected: option?.value, | ||
classNameInput: 'fs-14', | ||
placeholder: 'Value', | ||
handleChange: (data) => { | ||
listOptions[index] = { value: data.target.value }; | ||
setListOptions(listOptions); | ||
field.handleChange(listOptions); | ||
}, | ||
}} | ||
/> | ||
</div> | ||
<div | ||
className="border-1 rounded-1 d-flex align-items-center justify-content-center ms-24 px-8px cursor-pointer" | ||
onClick={() => { | ||
let array = [...listOptions]; | ||
array.splice(index, 1); | ||
setListOptions(array); | ||
field.handleChange(array); | ||
}} | ||
> | ||
<SVGComponent url="/assets/images/cancel.svg" className={'bg-danger'} /> | ||
</div> | ||
</div> | ||
</Col> | ||
</Row> | ||
</div> | ||
); | ||
})} | ||
<Button | ||
variant={`light`} | ||
className={`px-24 py-10 fw-semibold d-flex align-items-center rounded-1 border border-success border-da-1 mt-16`} | ||
onClick={() => { | ||
setListOptions([...listOptions, '']); | ||
}} | ||
> | ||
<SVGComponent url="/assets/images/plus.svg" className={`me-15`} /> | ||
{t('txt_add')} | ||
</Button> | ||
</> | ||
); | ||
}; | ||
|
||
export default withTranslation()(FormYoutube); |
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,15 @@ | ||
/* | ||
* @copyright Copyright (C) 2022 AesirX. All rights reserved. | ||
* @license GNU General Public License version 3, see LICENSE. | ||
*/ | ||
|
||
@import '../../../scss/utils/bootstrap.scss'; | ||
|
||
.input-format { | ||
position: absolute; | ||
top: 1px; | ||
right: 0; | ||
width: 60px; | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
} |
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
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
Oops, something went wrong.