From 038b7d627c513a86911b62177b64ef7b2c54d729 Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Mon, 6 Feb 2023 19:18:08 +0300 Subject: [PATCH] Fixed themes --- example/index.js | 1 - index.js | 2 +- src/components/theme/theme.ts | 13 +++++++------ src/interfaces/cg-select.interface.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/example/index.js b/example/index.js index 1802f47..853b3c0 100644 --- a/example/index.js +++ b/example/index.js @@ -25,7 +25,6 @@ const dropdown = new CGSelect({ width: '824px', }, }, - // multiselect: true, }); dropdown.on('clear', function (e) { diff --git a/index.js b/index.js index d3c8b2f..cae98de 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ -import { CGSelect } from './src/cg-select'; +import { CGSelect } from './src/cg-select.ts'; export default CGSelect; diff --git a/src/components/theme/theme.ts b/src/components/theme/theme.ts index 6904a94..3b4f393 100644 --- a/src/components/theme/theme.ts +++ b/src/components/theme/theme.ts @@ -5,26 +5,27 @@ export function changeTheme(element: Element, theme: string) { const search = element!.querySelector('.inputSearch'); const path = element.querySelectorAll('.pathWhite'); + select!.classList.remove('classicSelect'); + list!.classList.remove('classicList'); + path.forEach((elem) => { + elem.classList.remove('pathBlack'); + elem.classList.remove('pathWhite'); + }); + switch (theme) { case 'dark': - select!.classList.remove('classicSelect'); select!.classList.add('selectDark'); list!.classList.add('listDark'); - list!.classList.remove('classicList'); path.forEach((elem) => { - elem.classList.remove('pathBlack'); elem.classList.add('pathWhite'); }); break; case 'white': - select!.classList.remove('classicSelect'); select!.classList.add('selectWhite'); caret!.classList.add('caretWhite'); list!.classList.add('listWhite'); - list!.classList.remove('classicList'); path.forEach((elem) => { elem.classList.add('pathBlack'); - elem.classList.remove('pathWhite'); }); if (search!) { diff --git a/src/interfaces/cg-select.interface.ts b/src/interfaces/cg-select.interface.ts index 63d0b8f..403b1a6 100644 --- a/src/interfaces/cg-select.interface.ts +++ b/src/interfaces/cg-select.interface.ts @@ -27,7 +27,7 @@ export interface ICgSelect { items?: IItems[] | string[] | any; /** * An optional parameter responsible for switching between different themes, the classic theme is set by default. - * @type {string} + * @type {string} values: dark, white */ theme?: string; /**