Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
ajs-10 burger-builder
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
Pavel Mishakov
ajs-10 burger-builder
Commits
9ac633fe
Commit
9ac633fe
authored
Dec 13, 2022
by
Pavel Mishakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lesson 63 finished
parent
3fbdb3a6
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
242 additions
and
6 deletions
+242
-6
App.js
src/App.js
+10
-5
apiBurger.js
src/api/apiBurger.js
+0
-1
burger_logo.png
src/assets/images/burger_logo.png
+0
-0
Layout.css
src/components/Layout/Layout.css
+3
-0
Layout.js
src/components/Layout/Layout.js
+18
-0
NavigationItem.css
...igation/NavigationItems/NavigationItem/NavigationItem.css
+27
-0
NavigationItem.js
...vigation/NavigationItems/NavigationItem/NavigationItem.js
+16
-0
NavigationItems.css
...components/Navigation/NavigationItems/NavigationItems.css
+9
-0
NavigationItems.js
src/components/Navigation/NavigationItems/NavigationItems.js
+15
-0
Toolbar.css
src/components/Navigation/Toolbar/Toolbar.css
+22
-0
Toolbar.js
src/components/Navigation/Toolbar/Toolbar.js
+20
-0
OrderItem.css
src/components/Order/OrderItem/OrderItem.css
+15
-0
OrderItem.js
src/components/Order/OrderItem/OrderItem.js
+17
-0
Logo.css
src/components/UI/Logo/Logo.css
+12
-0
Logo.js
src/components/UI/Logo/Logo.js
+15
-0
Orders.js
src/containers/Orders/Orders.js
+43
-0
No files found.
src/App.js
View file @
9ac633fe
...
...
@@ -2,16 +2,21 @@ import { BrowserRouter, Route, Routes } from "react-router-dom";
import
BurgerBuilder
from
"./containers/BurgerBuilder/BurgerBuilder"
;
import
Checkout
from
"./containers/Checkout/Checkout"
;
import
ContactData
from
"./containers/Checkout/ContactData/ContactData"
;
import
Layout
from
"./components/Layout/Layout"
;
import
Orders
from
"./containers/Orders/Orders"
;
function
App
()
{
return
(
<
BrowserRouter
>
<
Routes
>
<
Route
element
=
{
<
Layout
/>
}
>
<
Route
path
=
'/'
element
=
{
<
BurgerBuilder
/>
}
/
>
<
Route
path
=
'/checkout'
element
=
{
<
Checkout
/>
}
>
<
Route
path
=
'contact-data'
element
=
{
<
ContactData
/>
}
/
>
<
/Route
>
<
Route
path
=
{
'/orders'
}
element
=
{
<
Orders
/>
}
/
>
<
Route
path
=
'*'
element
=
{
<
div
>
NOT
FOUND
<
/div>} /
>
<
/Route
>
<
/Routes
>
<
/BrowserRouter
>
);
...
...
src/api/apiBurger.js
View file @
9ac633fe
import
{
burgerInstance
}
from
"./instances"
;
class
ApiBurger
{
getOrders
=
async
()
=>
{
try
{
...
...
src/assets/images/burger_logo.png
0 → 100644
View file @
9ac633fe
14.3 KB
src/components/Layout/Layout.css
0 → 100644
View file @
9ac633fe
.Layout-Content
{
margin-top
:
72px
;
}
\ No newline at end of file
src/components/Layout/Layout.js
0 → 100644
View file @
9ac633fe
import
React
from
'react'
import
'./Layout.css'
import
{
Outlet
}
from
"react-router-dom"
;
import
Toolbar
from
"../Navigation/Toolbar/Toolbar"
;
const
Layout
=
(
props
)
=>
{
return
(
<>
<
Toolbar
/>
<
main
className
=
{
'Layout-Content'
}
>
<
Outlet
/>
<
/main
>
<
/
>
)
}
export
default
Layout
\ No newline at end of file
src/components/Navigation/NavigationItems/NavigationItem/NavigationItem.css
0 → 100644
View file @
9ac633fe
.NavigationItem
{
margin
:
0
;
height
:
100%
;
display
:
flex
;
align-items
:
center
;
box-sizing
:
border-box
;
}
.NavigationItem
a
{
color
:
white
;
height
:
100%
;
padding
:
16px
10px
;
border-bottom
:
4px
solid
transparent
;
text-decoration
:
none
;
width
:
100%
;
display
:
block
;
box-sizing
:
border-box
;
}
.NavigationItem
a
:hover
,
.NavigationItem
a
:active
,
.NavigationItem
a
.active
{
background-color
:
#8f5c2c
;
border-bottom
:
4px
solid
#40a4c8
;
color
:
white
;
}
\ No newline at end of file
src/components/Navigation/NavigationItems/NavigationItem/NavigationItem.js
0 → 100644
View file @
9ac633fe
import
React
from
"react"
;
import
'./NavigationItem.css'
import
{
NavLink
}
from
"react-router-dom"
;
const
NavigationItem
=
(
props
)
=>
{
return
(
<
li
className
=
{
'NavigationItem'
}
>
<
NavLink
to
=
{
props
.
to
}
end
=
{
props
.
end
}
>
{
props
.
children
}
<
/NavLink
>
<
/li
>
)
}
export
default
NavigationItem
\ No newline at end of file
src/components/Navigation/NavigationItems/NavigationItems.css
0 → 100644
View file @
9ac633fe
.NavigationItems
{
margin
:
0
;
padding
:
0
;
list-style
:
none
;
display
:
flex
;
flex-flow
:
row
;
align-items
:
center
;
height
:
100%
;
}
src/components/Navigation/NavigationItems/NavigationItems.js
0 → 100644
View file @
9ac633fe
import
React
from
"react"
;
import
'./NavigationItems.css'
import
{
NavLink
}
from
"react-router-dom"
;
import
NavigationItem
from
"./NavigationItem/NavigationItem"
;
const
NavigationItems
=
()
=>
{
return
(
<
ul
className
=
{
'NavigationItems'
}
>
<
NavigationItem
to
=
{
'/'
}
end
>
Burger
Builder
<
/NavigationItem
>
<
NavigationItem
to
=
{
'/orders'
}
end
>
Orders
<
/NavigationItem
>
<
/ul
>
)
}
export
default
NavigationItems
\ No newline at end of file
src/components/Navigation/Toolbar/Toolbar.css
0 → 100644
View file @
9ac633fe
.Toolbar
{
height
:
56px
;
width
:
100%
;
position
:
fixed
;
top
:
0
;
left
:
0
;
background-color
:
#703b09
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
0
20px
;
box-sizing
:
border-box
;
z-index
:
90
;
/* Should be lower than backdrop */
}
.Toolbar
nav
{
height
:
100%
;
}
.Toolbar-logo
{
height
:
80%
;
}
\ No newline at end of file
src/components/Navigation/Toolbar/Toolbar.js
0 → 100644
View file @
9ac633fe
import
React
from
"react"
;
import
'./Toolbar.css'
;
import
Logo
from
"../../UI/Logo/Logo"
;
import
NavigationItems
from
"../NavigationItems/NavigationItems"
;
const
Toolbar
=
()
=>
{
return
(
<
header
className
=
{
'Toolbar'
}
>
<
div
className
=
{
'Toolbar-logo'
}
>
<
Logo
/>
<
/div
>
<
nav
>
<
NavigationItems
/>
<
/nav
>
<
/header
>
)
}
export
default
Toolbar
\ No newline at end of file
src/components/Order/OrderItem/OrderItem.css
0 → 100644
View file @
9ac633fe
.OrderItem
{
width
:
80%
;
border
:
1px
solid
#eee
;
box-shadow
:
0
2px
3px
#ccc
;
padding
:
10px
;
margin
:
10px
auto
;
box-sizing
:
border-box
;
}
.OrderItem__li
{
text-transform
:
capitalize
;
display
:
block
;
margin
:
0
8px
;
border
:
1px
solid
#ccc
;
padding
:
5px
;
}
\ No newline at end of file
src/components/Order/OrderItem/OrderItem.js
0 → 100644
View file @
9ac633fe
import
React
from
"react"
;
import
'./OrderItem.css'
const
OrderItem
=
(
props
)
=>
{
const
ingredientOutput
=
Object
.
keys
(
props
.
ingredients
).
map
((
key
,
i
)
=>
{
return
<
li
className
=
{
'OrderItem__li'
}
key
=
{
i
}
>
{
key
}:
{
props
.
ingredients
[
key
]}
<
/li
>
})
return
(
<
div
className
=
{
'OrderItem'
}
>
<
ul
><
strong
>
Ingredients
:
<
/strong> {ingredientOutput}</
ul
>
<
p
>
Price
:
<
strong
>
{
props
.
price
}
KZT
<
/strong></
p
>
<
/div
>
)
}
export
default
OrderItem
\ No newline at end of file
src/components/UI/Logo/Logo.css
0 → 100644
View file @
9ac633fe
.Logo
{
background-color
:
white
;
padding
:
8px
;
height
:
100%
;
box-sizing
:
border-box
;
border-radius
:
5px
;
display
:
block
;
}
.Logo
img
{
height
:
100%
;
}
\ No newline at end of file
src/components/UI/Logo/Logo.js
0 → 100644
View file @
9ac633fe
import
React
from
"react"
;
import
'./Logo.css'
import
burgerLogo
from
'../../../assets/images/burger_logo.png'
import
{
Link
}
from
"react-router-dom"
;
const
Logo
=
()
=>
{
return
(
<
Link
to
=
{
'/'
}
className
=
{
'Logo'
}
>
{
/*<img src="https://image.ibb.co/e3Pkkx/burger_logo.png" alt="MyBurger"/>*/
}
<
img
src
=
{
burgerLogo
}
alt
=
"MyBurger"
/>
<
/Link
>
)
}
export
default
Logo
\ No newline at end of file
src/containers/Orders/Orders.js
0 → 100644
View file @
9ac633fe
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
apiBurger
}
from
"../../api/apiBurger"
;
import
Spinner
from
"../../components/UI/Spinner/Spinner"
;
import
OrderItem
from
"../../components/Order/OrderItem/OrderItem"
;
const
Orders
=
()
=>
{
const
[
orders
,
setOrders
]
=
useState
({})
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
getOrders
=
async
()
=>
{
setLoading
(
true
)
try
{
const
response
=
await
apiBurger
.
getOrders
()
setOrders
(
response
)
}
finally
{
setLoading
(
false
)
}
}
useEffect
(()
=>
{
getOrders
()
},
[])
return
(
<>
{
loading
?
<
Spinner
/>
:
<
div
>
{
Object
.
keys
(
orders
).
map
((
key
,
i
)
=>
{
return
<
OrderItem
key
=
{
key
}
ingredients
=
{
orders
[
key
].
ingredients
}
price
=
{
orders
[
key
].
price
}
/
>
})}
<
/div
>
}
<
/
>
)
}
export
default
Orders
\ No newline at end of file
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