Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IT2810 H21
Team 28
project-3
Commits
c4e3b22a
Commit
c4e3b22a
authored
Oct 31, 2021
by
DESKTOP-J7QTMBR\mikke
Browse files
cleanup
parent
f0039635
Changes
9
Show whitespace changes
Inline
Side-by-side
project-3/src/components/Layout.tsx
View file @
c4e3b22a
...
@@ -2,7 +2,6 @@ import React from 'react';
...
@@ -2,7 +2,6 @@ import React from 'react';
import
{
Header
}
from
'
./header/Header
'
;
import
{
Header
}
from
'
./header/Header
'
;
import
"
./Layout.css
"
import
"
./Layout.css
"
import
{
Searchbar
}
from
'
./searchbar/searchbar
'
;
import
{
Searchbar
}
from
'
./searchbar/searchbar
'
;
import
{
Filter
}
from
'
./searchbar/Filter
'
;
import
{
filterStore
}
from
'
../utils/filterStore
'
;
import
{
filterStore
}
from
'
../utils/filterStore
'
;
import
{
Provider
}
from
'
react-redux
'
;
import
{
Provider
}
from
'
react-redux
'
;
...
...
project-3/src/components/display/CountryCard.tsx
View file @
c4e3b22a
...
@@ -11,7 +11,6 @@ type IProps = {
...
@@ -11,7 +11,6 @@ type IProps = {
}
}
export
const
CountryCard
:
FunctionComponent
<
IProps
>
=
({
export
const
CountryCard
:
FunctionComponent
<
IProps
>
=
({
onClick
=
()
=>
null
,
country
,
country
,
id
id
})
=>
{
})
=>
{
...
...
project-3/src/components/searchbar/ContinentCheckbox.css
View file @
c4e3b22a
.ContinentCheckbox
{
.ContinentCheckbox
{
display
:
flex
;
display
:
flex
;
align-items
:
flex-start
;
align-items
:
flex-start
;
gap
:
30px
;
margin-top
:
200px
;
margin-top
:
200px
;
}
}
\ No newline at end of file
project-3/src/components/searchbar/ContinentCheckbox.tsx
View file @
c4e3b22a
import
React
,
{
FunctionComponent
,
useState
}
from
'
react
'
;
import
React
,
{
FunctionComponent
}
from
'
react
'
;
import
{
Button
,
ButtonGroup
,
Form
}
from
'
react-bootstrap
'
;
import
{
Button
,
ButtonGroup
}
from
'
react-bootstrap
'
;
import
{
searchbarStore
}
from
'
./SearchbarStore
'
;
//import './CountryCard.css';
//import './CountryCard.css';
...
@@ -20,6 +19,7 @@ export const ContinentCheckbox: FunctionComponent<Iprops> = ({ handleClick
...
@@ -20,6 +19,7 @@ export const ContinentCheckbox: FunctionComponent<Iprops> = ({ handleClick
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
"
SA
"
)}
}
>
Sør-Amerika
</
Button
>
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
"
SA
"
)}
}
>
Sør-Amerika
</
Button
>
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
"
NA
"
)}
}
>
Nord-Amerika
</
Button
>
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
"
NA
"
)}
}
>
Nord-Amerika
</
Button
>
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
"
OC
"
)}
}
>
Oseania
</
Button
>
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
"
OC
"
)}
}
>
Oseania
</
Button
>
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
{
handleClick
(
""
)}
}
>
All
</
Button
>
</
ButtonGroup
>
</
ButtonGroup
>
</>
</>
...
...
project-3/src/components/searchbar/Filter.tsx
View file @
c4e3b22a
import
{
CollapseFilled
,
ExpandFilled
,
Settings
}
from
'
@navikt/ds-icons
'
;
import
{
CollapseFilled
,
ExpandFilled
,
Settings
}
from
'
@navikt/ds-icons
'
;
import
React
,
{
FunctionComponent
,
useState
}
from
'
react
'
;
import
React
,
{
FunctionComponent
,
useState
}
from
'
react
'
;
import
{
Button
,
Form
}
from
'
react-bootstrap
'
;
import
{
Button
}
from
'
react-bootstrap
'
;
import
{
ContinentCheckbox
}
from
'
./ContinentCheckbox
'
;
import
{
ContinentCheckbox
}
from
'
./ContinentCheckbox
'
;
import
'
./Filter.css
'
;
import
'
./Filter.css
'
;
import
'
./ContinentCheckbox.css
'
import
'
./ContinentCheckbox.css
'
import
{
filterStore
}
from
'
../../utils/filterStore
'
;
type
IProps
=
{
type
IProps
=
{
onButtonClick
:
(
value
:
string
[])
=>
void
onButtonClick
:
(
value
:
string
[])
=>
void
...
@@ -14,7 +13,7 @@ export const Filter: FunctionComponent<IProps> = ({onButtonClick, filterClick})
...
@@ -14,7 +13,7 @@ export const Filter: FunctionComponent<IProps> = ({onButtonClick, filterClick})
const
[
hidden
,
setHidden
]
=
useState
(
true
);
const
[
hidden
,
setHidden
]
=
useState
(
true
);
const
filterOptions
=
<>
const
filterOptions
=
<>
<
div
className
=
{
"
Sorting
"
}
>
<
div
className
=
{
""
}
>
<
Button
variant
=
"secondary"
<
Button
variant
=
"secondary"
onClick
=
{
()
=>
onButtonClick
([
"
name
"
,
"
ASC
"
])
}
>
Name abc
</
Button
>
onClick
=
{
()
=>
onButtonClick
([
"
name
"
,
"
ASC
"
])
}
>
Name abc
</
Button
>
<
Button
variant
=
"secondary"
<
Button
variant
=
"secondary"
...
@@ -32,8 +31,8 @@ export const Filter: FunctionComponent<IProps> = ({onButtonClick, filterClick})
...
@@ -32,8 +31,8 @@ export const Filter: FunctionComponent<IProps> = ({onButtonClick, filterClick})
return
(
return
(
<>
<>
<
div
className
=
{
"
Filter__Big_Container
"
}
>
<
div
className
=
{
"
Filter__Big_Container
"
}
>
<
Settings
/>
<
div
>
Filter Options
</
div
>
<
div
>
<
Settings
/>
Filter Options
</
div
>
<
div
className
=
{
"
Filter__Big_Buttons
"
}
>
<
div
className
=
{
"
Filter__Big_Buttons
"
}
>
{
filterOptions
}
{
filterOptions
}
</
div
>
</
div
>
...
@@ -43,8 +42,7 @@ export const Filter: FunctionComponent<IProps> = ({onButtonClick, filterClick})
...
@@ -43,8 +42,7 @@ export const Filter: FunctionComponent<IProps> = ({onButtonClick, filterClick})
<
div
className
=
{
"
Filter__Container
"
}
>
<
div
className
=
{
"
Filter__Container
"
}
>
<
div
className
=
{
'
Filter__Title
'
}
onClick
=
{
()
=>
setHidden
(
true
)
}
>
<
div
className
=
{
'
Filter__Title
'
}
onClick
=
{
()
=>
setHidden
(
true
)
}
>
<
Settings
/>
<
div
><
Settings
/>
Options
</
div
>
<
div
>
Options
</
div
>
<
CollapseFilled
/>
<
CollapseFilled
/>
</
div
>
</
div
>
<
div
className
=
{
'
Filter__Options
'
}
>
<
div
className
=
{
'
Filter__Options
'
}
>
...
...
project-3/src/components/searchbar/countries.json
deleted
100644 → 0
View file @
f0039635
[
{
"AD"
:
{
"name"
:
"Andorra"
,
"native"
:
"Andorra"
,
"phone"
:
"376"
,
"continent"
:
"EU"
,
"capital"
:
"Andorra la Vella"
,
"currency"
:
"EUR"
,
"languages"
:
[
"ca"
]
},
"AE"
:
{
"name"
:
"United Arab Emirates"
,
"native"
:
"دولة الإمارات العربية المتحدة"
,
"phone"
:
"971"
,
"continent"
:
"AS"
,
"capital"
:
"Abu Dhabi"
,
"currency"
:
"AED"
,
"languages"
:
[
"ar"
]
},
"AF"
:
{
"name"
:
"Afghanistan"
,
"native"
:
"افغانستان"
,
"phone"
:
"93"
,
"continent"
:
"AS"
,
"capital"
:
"Kabul"
,
"currency"
:
"AFN"
,
"languages"
:
[
"ps"
,
"uz"
,
"tk"
]
},
"AG"
:
{
"name"
:
"Antigua and Barbuda"
,
"native"
:
"Antigua and Barbuda"
,
"phone"
:
"1268"
,
"continent"
:
"NA"
,
"capital"
:
"Saint John's"
,
"currency"
:
"XCD"
,
"languages"
:
[
"en"
]
},
"AI"
:
{
"name"
:
"Anguilla"
,
"native"
:
"Anguilla"
,
"phone"
:
"1264"
,
"continent"
:
"NA"
,
"capital"
:
"The Valley"
,
"currency"
:
"XCD"
,
"languages"
:
[
"en"
]
}
}
]
\ No newline at end of file
project-3/src/components/searchbar/searchbar.tsx
View file @
c4e3b22a
...
@@ -4,7 +4,6 @@ import './SearchbarStore.tsx'
...
@@ -4,7 +4,6 @@ import './SearchbarStore.tsx'
import
{
searchbarStore
}
from
'
./SearchbarStore
'
;
import
{
searchbarStore
}
from
'
./SearchbarStore
'
;
import
{
getAllData
,
getNumberOfResults
}
from
'
../../utils/APIUtil
'
;
import
{
getAllData
,
getNumberOfResults
}
from
'
../../utils/APIUtil
'
;
import
{
store
}
from
'
../display/Store
'
;
import
{
store
}
from
'
../display/Store
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
Filter
}
from
'
./Filter
'
;
import
{
Filter
}
from
'
./Filter
'
;
const
PAGE_LIMIT
:
number
=
20
;
const
PAGE_LIMIT
:
number
=
20
;
...
@@ -78,7 +77,6 @@ export class Searchbar extends React.Component<IProps, IState> {
...
@@ -78,7 +77,6 @@ export class Searchbar extends React.Component<IProps, IState> {
return
(
return
(
<>
<>
<
div
className
=
"searchbar"
>
<
div
className
=
"searchbar"
>
<
input
type
=
"text"
className
=
"form-control"
placeholder
=
"Enter Country"
onInput
=
{
(
e
)
=>
{
this
.
setState
({
search_text
:
e
.
currentTarget
.
value
});
this
.
setState
({
page_number
:
0
});}
}
/>
<
input
type
=
"text"
className
=
"form-control"
placeholder
=
"Enter Country"
onInput
=
{
(
e
)
=>
{
this
.
setState
({
search_text
:
e
.
currentTarget
.
value
});
this
.
setState
({
page_number
:
0
});}
}
/>
<
div
className
=
"input-group-append"
>
<
div
className
=
"input-group-append"
>
<
button
id
=
"search_button"
onClick
=
{
()
=>
this
.
onSearch
()
}
<
button
id
=
"search_button"
onClick
=
{
()
=>
this
.
onSearch
()
}
...
...
project-3/src/utils/APIUtil.tsx
View file @
c4e3b22a
import
React
from
'
react
'
;
import
axios
,
{
AxiosResponse
}
from
'
axios
'
;
import
axios
,
{
AxiosResponse
}
from
'
axios
'
;
import
{
Country
}
from
'
../interfaces/Country
'
;
import
{
Country
}
from
'
../interfaces/Country
'
;
...
...
project-3/src/utils/filterStore.tsx
View file @
c4e3b22a
import
{
createStore
}
from
'
redux
'
import
{
createStore
}
from
'
redux
'
export
interface
filterOptions
{
export
interface
I
filterOptions
{
search
:
string
,
search
:
string
,
start
:
number
,
start
:
number
,
limit
:
number
,
limit
:
number
,
continent
:
string
,
continent
:
string
,
order
:
string
order
:
string
}
//search: "", start: 0, limit: 0, continent: "", order: ""
}
//search: "", start: 0, limit: 0, continent: "", order: ""
const
initState
:
filterOptions
=
{
const
initState
:
I
filterOptions
=
{
search
:
''
,
search
:
''
,
start
:
0
,
start
:
0
,
limit
:
0
,
limit
:
0
,
...
...
Write
Preview
Supports
Markdown
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