Skip to content

Instantly share code, notes, and snippets.

View asvae's full-sized avatar

Yauheni Prakopchyk asvae

View GitHub Profile
@asvae
asvae / inject-provide-store-example.md
Last active October 11, 2019 10:50
Inject-provide store example

Plugin (store-plugin.ts)

import { CheckOutStore } from '../services/store'

export const checkOutStoreInjectKey = Symbol('checkOutStore')

export const StorePlugin = {
  install (Vue: any): void {
    Vue.mixin({
      inject: {
import DomHelpers from './Utility/DomHelpers.js'
// ...
methods: {
click (event) {
DomHelpers.isChild(this.$el, event.target) || this.hide()
},
}
<div class="click-target-modal">
<div class="click-target-modal__content"
v-if="isDisplayed"
>
<slot></slot>
</div>
</div>
// ...
methods: {
show () {
this.isDisplayed = true
this.$emit('input', true)
this.listen(true)
},
hide () {
this.isDisplayed = false
this.$emit('input', false)
<div class="document-event-modal">
<div class="document-event-modal__content"
@click.stop
v-if="isDisplayed"
>
<slot></slot>
</div>
</div>
.full-screen-overlay-modal {
&__background {
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
&__content {
<div class="full-screen-overlay-modal">
<div class="background"
@click="hide()"
v-if="isDisplayed"
/>
<div class="content"
v-if="isDisplayed"
>
<slot></slot>
</div>
@asvae
asvae / Hunt for perfect modal.md
Created July 16, 2018 09:16
Hunt for perfect modal

Hunt for perfect modal

#modal #popup #javascript #vuejs 2017-05-08

vue navigation

Hey. Today we will pursue our dream for perfect modal. Being perfect means:

  • Floats above everything else.
  • Is not blocking.
  • Supports nesting of any depth.
@asvae
asvae / FieldRepository.js
Created September 1, 2017 22:17
FieldRepository.js
import Field from '../Domain/Entity/Field.js'
import FieldMapper from '../Domain/Mapper/FieldMapper.js'
import repoBus from '../../oop-store/repoBus'
import axios from '../../plugins/internal/axios-instance.js'
import MappingHelpers from '../Utility/Static/MappingHelpers.js'
export const FIELD_UPDATED = 'Field updated'
export const FIELD_CREATED = 'Field created'
@asvae
asvae / 2c2p promise loader
Created September 1, 2017 19:04
2c2p-promise-loader.js
let promise
export async function getMy2c2p () {
promise || (promise = new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = 'https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.9.min.js'
script.async = true
script.onload = () => {
resolve(My2c2p)
}