-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Дмитрий Никифоров
committed
Apr 23, 2022
1 parent
358704b
commit a7a6436
Showing
11 changed files
with
249 additions
and
50 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 was deleted.
Oops, something went wrong.
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,74 @@ | ||
import React, { createRef } from "react"; | ||
|
||
import { | ||
Panel, | ||
PanelHeader, | ||
PanelHeaderBack, | ||
Group, | ||
FormItem, | ||
Input, | ||
Button, | ||
Div, | ||
ButtonGroup, | ||
Header, | ||
SimpleCell, | ||
IconButton, | ||
} from "@vkontakte/vkui"; | ||
|
||
import { useSelector, useDispatch } from "react-redux"; | ||
import { setLocation, removeLocation } from "../store/features/locations"; | ||
|
||
import "./Game.css"; | ||
import { | ||
Icon28ClearDataOutline, | ||
Icon28RemoveCircleOutline, | ||
} from "@vkontakte/icons"; | ||
|
||
const CreateLocations = ({ id, go }) => { | ||
const newLocation = createRef(); | ||
const dispatch = useDispatch(); | ||
const locationsList = useSelector((state) => state.locations.locations); | ||
|
||
const createLocation = () => { | ||
dispatch(setLocation(newLocation.current.value)); | ||
newLocation.current.value = ""; | ||
}; | ||
|
||
return ( | ||
<Panel id={id}> | ||
<PanelHeader left={<PanelHeaderBack onClick={go} data-to="home" />}> | ||
Находка для шпиона | ||
</PanelHeader> | ||
<Group> | ||
<Header>Мои локации</Header> | ||
<Div> | ||
<FormItem top="Введите название локации"> | ||
<Input type="text" getRef={newLocation} /> | ||
</FormItem> | ||
<ButtonGroup stretched> | ||
<Button mode="outline" stretched onClick={() => createLocation()}> | ||
Добавить локацию | ||
</Button> | ||
</ButtonGroup> | ||
</Div> | ||
<Div> | ||
{Object.keys(locationsList)?.map((locationId) => ( | ||
<SimpleCell | ||
after={ | ||
<IconButton | ||
onClick={() => dispatch(removeLocation(locationId))} | ||
> | ||
<Icon28RemoveCircleOutline /> | ||
</IconButton> | ||
} | ||
> | ||
{locationsList[locationId]} | ||
</SimpleCell> | ||
))} | ||
</Div> | ||
</Group> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default CreateLocations; |
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.