From 4dea68d2ef5f0e516251ff0e6e4044771ddca64f Mon Sep 17 00:00:00 2001 From: SchnapsterDog Date: Sat, 4 Nov 2023 03:44:36 +0100 Subject: [PATCH] style: replacing constants with enum inside transitionmap --- package.json | 2 +- src/constants/index.ts | 4 ---- src/utils/transitionmap.ts | 26 +++++++++++++------------- 3 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 src/constants/index.ts diff --git a/package.json b/package.json index 361959c..5082cb6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vue-preloader", "description": "Vue-Preloader is a versatile and easy-to-use Vue.js component that allows you to add loading animations to your Vue.js or Nuxt.js projects. It is compatible with both Vue 2 and Vue 3.", - "version": "1.1.2", + "version": "1.1.3", "private": false, "homepage": "https://vue-preloader.com/", "author": { diff --git a/src/constants/index.ts b/src/constants/index.ts deleted file mode 100644 index e6e354b..0000000 --- a/src/constants/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const TRANSITION_FADE_LEFT = 'fade-left'; -export const TRANSITION_FADE_RIGHT = 'fade-right'; -export const TRANSITION_FADE_UP = 'fade-up'; -export const TRANSITION_FADE_DOWN = 'fade-down'; diff --git a/src/utils/transitionmap.ts b/src/utils/transitionmap.ts index 195bae3..5990053 100644 --- a/src/utils/transitionmap.ts +++ b/src/utils/transitionmap.ts @@ -1,14 +1,14 @@ -import { - TRANSITION_FADE_LEFT, - TRANSITION_FADE_RIGHT, - TRANSITION_FADE_UP, - TRANSITION_FADE_DOWN -} from '../constants'; +enum Transition { + FADE_LEFT = 'fade-left', + FADE_RIGHT = 'fade-right', + FADE_UP = 'fade-up', + FADE_DOWN = 'fade-down', +} -export const transitionMap = { - [TRANSITION_FADE_LEFT]: { transform: 'translate(-100%, 0)' }, - [TRANSITION_FADE_RIGHT]: { transform: 'translate(100%, 0)' }, - [TRANSITION_FADE_UP]: { transform: 'translate(0, -100%)' }, - [TRANSITION_FADE_DOWN]: { transform: 'translate(0, 100%)' }, - default: { transform: 'transform(-100%, 0)' } -} \ No newline at end of file +export const transitionMap: Record = { + [Transition.FADE_LEFT]: { transform: 'translate(-100%, 0)' }, + [Transition.FADE_RIGHT]: { transform: 'translate(100%, 0)' }, + [Transition.FADE_UP]: { transform: 'translate(0, -100%)' }, + [Transition.FADE_DOWN]: { transform: 'translate(0, 100%)' }, + default: { transform: 'transform(-100%, 0)' }, +}; \ No newline at end of file