Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-promotion-react
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
inventory-promotion-react
Commits
a6fee5bc
Commit
a6fee5bc
authored
May 10, 2021
by
Ben Anderson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'AFP-11' into dev
parents
2971e4f7
59209607
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
44 deletions
+109
-44
Product.jsx
src/component/Product.jsx
+69
-13
Product.css
src/styles/Product.css
+15
-1
yarn.lock
yarn.lock
+25
-30
No files found.
src/component/Product.jsx
View file @
a6fee5bc
import
React
from
'react'
import
'./../styles/Product.css'
import
React
,
{
useState
}
from
"react"
;
import
"./../styles/Product.css"
;
import
{
Modal
,
Button
,
Alert
}
from
"react-bootstrap"
;
export
default
function
Product
({
product
})
{
export
default
function
Product
({
product
})
{
const
[
show
,
setShow
]
=
useState
(
false
);
const
[
showConfirm
,
setShowConfirm
]
=
useState
(
false
);
const
handleClose
=
()
=>
{
setShow
(
false
);
handleCloseConfirm
();
};
const
handleShow
=
()
=>
setShow
(
true
);
const
handleShowConfirm
=
()
=>
setShowConfirm
(
true
);
const
handleCloseConfirm
=
()
=>
setShowConfirm
(
false
);
return
(
<
div
>
<
div
className=
"img-container"
>
<
img
src=
{
product
.
productImageUrl
}
alt=
{
product
.
productName
}
/>
</
div
>
<
div
className=
"prod-info"
>
<
h5
>
{
product
.
productName
}
</
h5
>
{
product
.
sku
}
<
br
/>
$
{
product
.
price
}
<
br
/>
In Stock:
{
product
.
stock
}
</
div
>
<
div
className=
"img-container"
onClick=
{
handleShow
}
>
<
img
className=
"grid-img"
src=
{
product
.
productImageUrl
}
alt=
{
product
.
productName
}
/>
</
div
>
<
div
className=
"prod-info"
>
<
h5
>
{
product
.
productName
}
</
h5
>
{
product
.
sku
}
<
br
/>
$
{
product
.
price
}
<
br
/>
In Stock:
{
product
.
stock
}
</
div
>
<
Modal
show=
{
show
}
onHide=
{
handleClose
}
>
<
Modal
.
Header
closeButton
>
<
Modal
.
Title
>
{
product
.
productName
}
</
Modal
.
Title
>
</
Modal
.
Header
>
<
Modal
.
Body
>
<
div
className=
"modal-img"
>
<
img
src=
{
product
.
productImageUrl
}
alt=
{
product
.
productName
}
/>
</
div
>
<
h5
>
{
product
.
sku
}
</
h5
>
$
{
product
.
price
}
<
br
/>
{
product
.
productDescription
}
<
br
/>
In Stock:
{
product
.
stock
}
</
Modal
.
Body
>
<
Modal
.
Footer
>
<
Button
variant=
"danger"
className=
"float-left"
onClick=
{
handleShowConfirm
}
>
Delete product
</
Button
>
<
Button
variant=
"primary"
onClick=
{
handleClose
}
>
Edit Product
</
Button
>
<
Alert
show=
{
showConfirm
}
variant=
"danger"
>
<
h5
>
Are you sure?
</
h5
>
<
Button
variant=
"secondary"
onClick=
{
handleCloseConfirm
}
>
Cancel
</
Button
>
<
Button
variant=
"danger"
>
Yes, delete
</
Button
>
</
Alert
>
</
Modal
.
Footer
>
</
Modal
>
</
div
>
)
)
;
}
src/styles/Product.css
View file @
a6fee5bc
img
{
max-width
:
100%
;
max-height
:
250px
;
}
.img-container
{
position
:
relative
;
overflow
:
hidden
;
padding-bottom
:
100%
;
}
img
{
.grid-
img
{
position
:
absolute
;
max-width
:
100%
;
max-height
:
100%
;
top
:
50%
;
left
:
50%
;
transform
:
translateX
(
-50%
)
translateY
(
-50%
);
}
.modal-img
{
display
:
flex
;
justify-content
:
center
;
}
.alert
{
width
:
100%
;
}
\ No newline at end of file
yarn.lock
View file @
a6fee5bc
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment