Fixed themes
This commit is contained in:
parent
bcad805727
commit
038b7d627c
@ -25,7 +25,6 @@ const dropdown = new CGSelect({
|
|||||||
width: '824px',
|
width: '824px',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// multiselect: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dropdown.on('clear', function (e) {
|
dropdown.on('clear', function (e) {
|
||||||
|
2
index.js
2
index.js
@ -1,3 +1,3 @@
|
|||||||
import { CGSelect } from './src/cg-select';
|
import { CGSelect } from './src/cg-select.ts';
|
||||||
|
|
||||||
export default CGSelect;
|
export default CGSelect;
|
||||||
|
@ -5,26 +5,27 @@ export function changeTheme(element: Element, theme: string) {
|
|||||||
const search = element!.querySelector('.inputSearch');
|
const search = element!.querySelector('.inputSearch');
|
||||||
const path = element.querySelectorAll('.pathWhite');
|
const path = element.querySelectorAll('.pathWhite');
|
||||||
|
|
||||||
switch (theme) {
|
|
||||||
case 'dark':
|
|
||||||
select!.classList.remove('classicSelect');
|
select!.classList.remove('classicSelect');
|
||||||
select!.classList.add('selectDark');
|
|
||||||
list!.classList.add('listDark');
|
|
||||||
list!.classList.remove('classicList');
|
list!.classList.remove('classicList');
|
||||||
path.forEach((elem) => {
|
path.forEach((elem) => {
|
||||||
elem.classList.remove('pathBlack');
|
elem.classList.remove('pathBlack');
|
||||||
|
elem.classList.remove('pathWhite');
|
||||||
|
});
|
||||||
|
|
||||||
|
switch (theme) {
|
||||||
|
case 'dark':
|
||||||
|
select!.classList.add('selectDark');
|
||||||
|
list!.classList.add('listDark');
|
||||||
|
path.forEach((elem) => {
|
||||||
elem.classList.add('pathWhite');
|
elem.classList.add('pathWhite');
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'white':
|
case 'white':
|
||||||
select!.classList.remove('classicSelect');
|
|
||||||
select!.classList.add('selectWhite');
|
select!.classList.add('selectWhite');
|
||||||
caret!.classList.add('caretWhite');
|
caret!.classList.add('caretWhite');
|
||||||
list!.classList.add('listWhite');
|
list!.classList.add('listWhite');
|
||||||
list!.classList.remove('classicList');
|
|
||||||
path.forEach((elem) => {
|
path.forEach((elem) => {
|
||||||
elem.classList.add('pathBlack');
|
elem.classList.add('pathBlack');
|
||||||
elem.classList.remove('pathWhite');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (search!) {
|
if (search!) {
|
||||||
|
@ -27,7 +27,7 @@ export interface ICgSelect {
|
|||||||
items?: IItems[] | string[] | any;
|
items?: IItems[] | string[] | any;
|
||||||
/**
|
/**
|
||||||
* An optional parameter responsible for switching between different themes, the classic theme is set by default.
|
* 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;
|
theme?: string;
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user