-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Shirokuiu/module2-task1
- Loading branch information
Showing
29 changed files
with
854 additions
and
207 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,62 @@ | ||
<template> | ||
<div class="counter"> | ||
<button | ||
type="button" | ||
class="counter__button counter__button--disabled counter__button--minus" | ||
@click="dec" | ||
> | ||
<span class="visually-hidden">Меньше</span> | ||
</button> | ||
<input | ||
type="text" | ||
name="counter" | ||
class="counter__input" | ||
:value="count" | ||
@change="onInputChange" | ||
/> | ||
<button | ||
type="button" | ||
class="counter__button counter__button--plus" | ||
@click="inc" | ||
> | ||
<span class="visually-hidden">Больше</span> | ||
</button> | ||
</div> | ||
</template> | ||
<script> | ||
import { countAction } from "../constants"; | ||
export default { | ||
name: "AppCounter", | ||
props: { | ||
count: { | ||
type: Number, | ||
required: true, | ||
}, | ||
}, | ||
methods: { | ||
inc() { | ||
this.$emit("onCountUpdate", { | ||
action: countAction.INC, | ||
value: null, | ||
}); | ||
}, | ||
dec() { | ||
this.$emit("onCountUpdate", { | ||
action: countAction.DEC, | ||
value: null, | ||
}); | ||
}, | ||
onInputChange(evt) { | ||
this.$emit("onCountUpdate", { | ||
action: countAction.INPUT_CHANGE, | ||
value: evt.target.value, | ||
}); | ||
}, | ||
}, | ||
}; | ||
</script> |
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,36 @@ | ||
<template> | ||
<div | ||
:draggable="true" | ||
@dragstart.self="onDrag" | ||
@dragover.prevent | ||
@dragenter.prevent | ||
> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { MOVE, DATA_TRANSFER_PAYLOAD } from "./constants"; | ||
export default { | ||
name: "AppDrag", | ||
props: { | ||
transferData: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
methods: { | ||
onDrag({ dataTransfer }) { | ||
dataTransfer.effectAllowed = MOVE; | ||
dataTransfer.dropEffect = MOVE; | ||
dataTransfer.setData( | ||
DATA_TRANSFER_PAYLOAD, | ||
JSON.stringify(this.transferData) | ||
); | ||
}, | ||
}, | ||
}; | ||
</script> |
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,28 @@ | ||
<template> | ||
<div @drop.stop="onDrop" @dragover.prevent @dragenter.prevent> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { DATA_TRANSFER_PAYLOAD } from "./constants"; | ||
export default { | ||
name: "AppDrop", | ||
methods: { | ||
onDrop({ dataTransfer }) { | ||
if (!dataTransfer) { | ||
return; | ||
} | ||
const payload = dataTransfer.getData(DATA_TRANSFER_PAYLOAD); | ||
if (payload) { | ||
const transferData = JSON.parse(payload); | ||
this.$emit("drop", transferData); | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> |
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,46 @@ | ||
<template> | ||
<label class="radio"> | ||
<input | ||
type="radio" | ||
:name="radioName" | ||
:value="value" | ||
:checked="isChecked" | ||
@change="onRadioChange(value)" | ||
/> | ||
<span>{{ name }}</span> | ||
</label> | ||
</template> | ||
<script> | ||
export default { | ||
name: "AppRadioButton", | ||
props: { | ||
radioName: { | ||
type: String, | ||
default: "AppRadioButton", | ||
}, | ||
value: { | ||
type: [Object, String], | ||
required: true, | ||
}, | ||
isChecked: { | ||
type: Boolean, | ||
required: true, | ||
}, | ||
name: { | ||
type: String, | ||
default: "Радио кнопка", | ||
}, | ||
}, | ||
methods: { | ||
onRadioChange(value) { | ||
this.$emit("onRadioChange", value); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
<style></style> |
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,25 @@ | ||
<template> | ||
<div class="sheet"> | ||
<h2 class="title title--small sheet__title">{{ title }}</h2> | ||
|
||
<div class="sheet__content"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
name: "AppWidget", | ||
props: { | ||
title: { | ||
type: String, | ||
default: "Заголовок", | ||
}, | ||
classMods: { | ||
type: Array, | ||
}, | ||
}, | ||
}; | ||
</script> |
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,2 @@ | ||
export const MOVE = "move"; | ||
export const DATA_TRANSFER_PAYLOAD = "payload"; |
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,6 @@ | ||
export const countAction = { | ||
INC: "inc", | ||
DEC: "dec", | ||
INPUT_CHANGE: "inputChange", | ||
DROP: "drop", | ||
}; |
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 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,21 @@ | ||
<template> | ||
<div> | ||
<TheHeader /> | ||
|
||
<Index /> | ||
</div> | ||
</template> | ||
<script> | ||
import TheHeader from "../modules/header/components/TheHeader"; | ||
import Index from "../views/Index"; | ||
export default { | ||
name: "AppLayout", | ||
components: { | ||
TheHeader, | ||
Index, | ||
}, | ||
}; | ||
</script> | ||
<style></style> |
Empty file.
Oops, something went wrong.