From 5c0f244eb12f9787951fd3d5f3a69e495fae497a Mon Sep 17 00:00:00 2001 From: MaxOvs Date: Mon, 19 Dec 2022 22:48:05 +0300 Subject: [PATCH] Added code example --- src/index.html | 194 +++++++++++++++++++++++++++++++++---- src/index.js | 3 - src/style/ExemplePage.scss | 44 ++++++++- 3 files changed, 214 insertions(+), 27 deletions(-) diff --git a/src/index.html b/src/index.html index dca770f..110e62f 100644 --- a/src/index.html +++ b/src/index.html @@ -26,9 +26,9 @@
+

Дефолтный селект

-
-

Дефолтный селект

+
@@ -36,44 +36,117 @@
-              const dropdown = new DropDown({
-                selector: '.cg-dropdown_one',
-                placeholder: 'Выберите авто',
-                lable: 'EXAMPLE',
+              const dropdown = new DropDown({
+                selector: '.cg-dropdown_one', 
+                placeholder: 'Выберите авто', 
+                lable: 'EXAMPLE', 
+                span.code__string 
                 items: [
-                  'BMW',
+                  'BMW',
                   {
-                    id: '213sade',
-                    title: 'Opel',
+                    id: '213sade',
+                    title: 'Opel',
                     value: 1,
                   },
-                  'Mersedes',
-                  'MAN',
-                  'Ferari',
+                  'Mersedes', 
+                  'MAN',  
+                  'Ferari', 
                 ],
                 styles: {
                   head: {
-                    width: '830px',
+                    width: '830px', 
                   },
                   list: {
-                    width: '824px',
+                    width: '824px', 
                   },
                 },
               });
             
-

Селект с данными с URL

- +
+ +
+ + +
+            const dropdown = new DropDown({
+              selector: '.cg-dropdown_three', 
+              placeholder: 'URL', 
+              url: 'https://jsonplaceholder.typicode.com/users',            
+              searchMode: true,
+              darkTheme: false,
+              language: 'ru',
+              styles: {
+                head: {
+                  width: '830px', 
+                },
+                list: {
+                  width: '824px', 
+                },
+              },
+            });
+          
+

Категории

- + +
+ +
+ + +
+            const dropdown = new DropDown({
+              selector: '.cg-dropdown_categories', 
+              placeholder: 'Выберите регион', 
+              searchMode: true,
+              items: [
+                {
+                  category: 'Russia',
+                  categoryItems: [
+                    {
+                      id: '28qwds',
+                      title: 'Москва',
+                      value: 0,
+                    },
+                    'Ростов-на-дону',
+                    'Саратов',
+                    'Волгоград',
+                    'Донецк',
+                  ],
+                },
+                {
+                  category: 'USA',
+                  categoryItems: ['Alabama', 'Texas', 'Colorado', 'Klirens', 'Los-Angeles'],
+                },
+                {
+                  category: 'France',
+                  categoryItems: ['Paris'],
+                },
+              ],
+              styles: {
+                head: {
+                  width: '830px', 
+                },
+                list: {
+                  width: '824px', 
+                },
+                placeholder: {
+                  maxWidth: '500px ',
+                },
+              },
+              multiselect: true,
+              multiselectTag: true,
+            });
+          
+
@@ -82,7 +155,54 @@
- + +
+ +
+ + +
+            const dropdown = new DropDown({
+              selector: '.cg-dropdown_usedBtn', 
+              placeholder: 'Выберите авто', 
+              searchMode: true,
+              items: [
+                  'BMW',
+                  {
+                    id: '213sade',
+                    title: 'Opel',
+                    value: 1,
+                  },
+                  'Mersedes', 
+                  'MAN',  
+                  'max', 
+              ],
+              styles: {
+                head: {
+                  width:  '830px',
+                  color:  'black',
+                  backgroundColor:  'rgb(176 223 167)',
+                },
+                list: {
+                  width:  '824px',
+                  color:  'black',
+                  backgroundColor:  'rgb(176 223 167)',
+                },
+                caret: {
+                  borderTop:  '6px solid black',
+                },
+                search: {
+                  backgroundColor:  '#d7ffff',
+                  borderRadius:  '5px',
+                  borderBottom:  'none',
+                  width:  '95%',
+                  color:  'black',
+                },
+              },
+              multiselect: true,
+            });
+          
+
@@ -90,7 +210,43 @@ - + +
+ +
+ + +
+            const dropdown = new DropDown({
+              selector: '.cg-dropdown_checkboxDisable', 
+              placeholder: 'Выберите авто', 
+              lable: 'EXAMPLE', 
+              span.code__string 
+              items: [
+                'BMW',
+                {
+                  id: '213sade',
+                  title: 'Opel',
+                  value: 1,
+                },
+                'Mersedes', 
+                'MAN',  
+                'Ferari', 
+              ],
+              styles: {
+                head: {
+                  width: '830px', 
+                },
+                list: {
+                  width: '824px', 
+                },
+                placeholder: {
+                  maxWidth: '500px ',
+                },
+              },
+            });
+          
+
diff --git a/src/index.js b/src/index.js index d6e950b..6b3eb2a 100644 --- a/src/index.js +++ b/src/index.js @@ -49,8 +49,6 @@ const dropdown3 = new DropDown({ width: '824px', }, }, - // multiselect: true, - // multiselectTag: true, }); // --------------------------------Категории-------------------------- @@ -103,7 +101,6 @@ const dropdownBtn = new DropDown({ selector: '.cg-dropdown_usedBtn', placeholder: 'Выберите авто', searchMode: true, - items: [ 'BMW', { diff --git a/src/style/ExemplePage.scss b/src/style/ExemplePage.scss index b12e816..21dd3ef 100644 --- a/src/style/ExemplePage.scss +++ b/src/style/ExemplePage.scss @@ -69,7 +69,6 @@ background-color: #5c5c5c; border-radius: 5px; margin: 15px 0 0 0; - //padding: 0 13px 13px 13px; &_title { height: 45px; @@ -83,11 +82,13 @@ } &_submit { + //background-color: #2a2f3b; width: 200px; height: 35px; border-radius: 10px; border: none; margin-top: 20px; + margin: 20px 15px; cursor: pointer; transition: 1s; -webkit-transition: 1s; @@ -104,10 +105,43 @@ -o-transition: 1s; } } + + .layout-select { + margin: 15px; + } } - - -pre{ - +pre { + background: #1e1e1e; + margin: 15px; + padding: 15px; + color: #88d0f7; + border-radius: 15px; + font-size: 16px; + line-height: 20px; +} + +.code { + &__class, + &__var, + &__string, + &__keyword { + font-size: 16px; + line-height: 20px; + } + &__class { + color: #4ec9b0; + } + + &__var { + color: #34a7ff; + } + + &__string { + color: #ce9178; + } + + &__keyword { + color: #5090ca; + } }