Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_7
Project
Project
Details
Activity
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
zarina
exam_7
Commits
e2db9d87
Commit
e2db9d87
authored
Mar 28, 2020
by
zarina
🌊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#5
, выведены в корзину данные о заказе
parent
95600ec5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
10 deletions
+30
-10
Basket.css
src/components/Basket/Basket.css
+1
-0
Basket.js
src/components/Basket/Basket.js
+15
-2
BaskeItem.js
src/components/Basket/BasketItem/BaskeItem.js
+8
-5
TotalPrice.css
src/components/Basket/TotalPrice/TotalPrice.css
+1
-0
TotalPrice.js
src/components/Basket/TotalPrice/TotalPrice.js
+2
-1
App.js
src/containers/App.js
+3
-2
No files found.
src/components/Basket/Basket.css
View file @
e2db9d87
...
@@ -3,4 +3,5 @@
...
@@ -3,4 +3,5 @@
border
:
3px
solid
silver
;
border
:
3px
solid
silver
;
min-height
:
400px
;
min-height
:
400px
;
border-radius
:
10px
0
0
10px
;
border-radius
:
10px
0
0
10px
;
padding-top
:
20px
;
}
}
\ No newline at end of file
src/components/Basket/Basket.js
View file @
e2db9d87
...
@@ -2,11 +2,24 @@ import React from "react";
...
@@ -2,11 +2,24 @@ import React from "react";
import
BasketItem
from
"./BasketItem/BaskeItem"
;
import
BasketItem
from
"./BasketItem/BaskeItem"
;
import
TotalPrice
from
"./TotalPrice/TotalPrice"
;
import
TotalPrice
from
"./TotalPrice/TotalPrice"
;
import
'./Basket.css'
import
'./Basket.css'
const
Basket
=
props
=>
{
const
Basket
=
props
=>
{
let
basketElements
=
Object
.
keys
(
props
.
basket
);
let
emptyBasket
=
'Basket empty. Please, add items'
;
let
createBasket
=
()
=>
{
return
basketElements
.
map
((
elem
,
i
)
=>
{
return
<
BasketItem
key
=
{
'BasketItem-'
+
{
elem
}
+
i
}
qty
=
{
props
.
basket
[
elem
]}
price
=
{
props
.
menuList
[
elem
].
price
}
name
=
{
elem
}
/>
;
});
}
return
(
return
(
<
div
className
=
'Basket'
>
<
div
className
=
'Basket'
>
<
BasketItem
/>
{
basketElements
.
length
>
0
?
createBasket
()
:
emptyBasket
}
<
TotalPrice
/>
{
props
.
totalPrice
>
0
?
<
TotalPrice
totalPrice
=
{
props
.
totalPrice
}
/> : null
}
<
/div
>
<
/div
>
);
);
};
};
...
...
src/components/Basket/BasketItem/BaskeItem.js
View file @
e2db9d87
...
@@ -4,9 +4,12 @@ import './BasketItem.css'
...
@@ -4,9 +4,12 @@ import './BasketItem.css'
const
BasketItem
=
props
=>
{
const
BasketItem
=
props
=>
{
return
(
return
(
<
div
className
=
'BasketItem'
>
<
div
className
=
'BasketItem'
>
<
h3
>
testik
<
/h3
>
<
h3
>
{
props
.
name
}
<
/h3
>
<
span
>
232
KZT
<
/span
>
<
div
>
<
span
>
x22
<
/span> </
div
>
<
span
>
{
props
.
price
}
KZT
<
/span
>
<
span
>
<
b
>
x
{
props
.
qty
}
<
/b></
span
>
<
/div
>
<
/div
>
);
);
};
};
...
...
src/components/Basket/TotalPrice/TotalPrice.css
View file @
e2db9d87
.TotalPrice
{
.TotalPrice
{
border-top
:
1px
solid
black
;
border-top
:
1px
solid
black
;
padding-top
:
10px
;
padding-top
:
10px
;
margin-top
:
10px
;
}
}
\ No newline at end of file
src/components/Basket/TotalPrice/TotalPrice.js
View file @
e2db9d87
...
@@ -3,7 +3,8 @@ import './TotalPrice.css'
...
@@ -3,7 +3,8 @@ import './TotalPrice.css'
const
TotalPrice
=
props
=>
{
const
TotalPrice
=
props
=>
{
return
(
return
(
<
div
className
=
'TotalPrice'
>
<
div
className
=
'TotalPrice'
>
4234234
KZT
<
/div
>
<
span
>
Total
price
:
{
props
.
totalPrice
}
KZT
<
/span
>
<
/div
>
);
);
};
};
...
...
src/containers/App.js
View file @
e2db9d87
...
@@ -47,11 +47,12 @@ class App extends Component {
...
@@ -47,11 +47,12 @@ class App extends Component {
let
totalPrice
=
this
.
state
.
totalPrice
+
this
.
state
.
menu
[
name
].
price
;
let
totalPrice
=
this
.
state
.
totalPrice
+
this
.
state
.
menu
[
name
].
price
;
this
.
setState
({
totalPrice
,
basket
})
this
.
setState
({
totalPrice
,
basket
})
};
};
render
()
{
render
()
{
return
(
return
(
<
div
className
=
'App'
>
<
div
className
=
'App'
>
<
Basket
/>
<
Basket
menuList
=
{
this
.
state
.
menu
}
totalPrice
=
{
this
.
state
.
totalPrice
}
basket
=
{
this
.
state
.
basket
}
/
>
<
Menu
menuList
=
{
this
.
state
.
menu
}
addElement
=
{
this
.
addElement
}
/
>
<
Menu
menuList
=
{
this
.
state
.
menu
}
addElement
=
{
this
.
addElement
}
/
>
<
/div
>
<
/div
>
)
)
...
...
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