diff options
update buttons, forms, labels, tables, tooltips and example docs
8 files changed, 112 insertions, 102 deletions
| -rw-r--r-- | demo/index.html | 60 | ||||
| -rw-r--r-- | dist/spectre.css | 114 | ||||
| -rw-r--r-- | src/buttons.less | 6 | ||||
| -rw-r--r-- | src/forms.less | 4 | ||||
| -rw-r--r-- | src/labels.less | 12 | ||||
| -rw-r--r-- | src/tables.less | 2 | ||||
| -rw-r--r-- | src/tooltips.less | 12 | ||||
| -rw-r--r-- | src/typography.less | 4 |
diff --git a/demo/index.html b/demo/index.html index 426e943..54801fe 100644 --- a/demo/index.html +++ b/demo/index.html @@ -7,13 +7,18 @@ <link rel="stylesheet" href="font/style.css"> <style> header > h4 { - margin-top: 4rem; + margin-top: 6rem; + margin-bottom: 2rem; } .bg-grey { background-color: #efefef; padding: 1rem; border-radius: .3rem; } + .notes { + margin: 2rem 0; + color: #666; + } </style> </head> <body> @@ -21,7 +26,7 @@ <section id="overview"> <header class="text-center"><h3>Project Spectre</h3></header> <header class="text-center"><h4>introduction</h4></header> - <section> + <section class="notes"> <p><a href="https://github.com/picturepan2/spectre" target="_blank">Project Spectre</a> is a lightweight and clean CSS framework for faster and extendable development.</p> <ul> <li>lightweight and clean starting point for your project</li> @@ -33,7 +38,7 @@ <section id="typography"> <header class="text-center"><h4>typography</h4></header> - <section> + <section class="notes"> <p><strong>typography.less</strong> sets default styles for headings, paragraphs, blockquote, lists elements and some text related utilities. </p> </section> @@ -89,8 +94,9 @@ <section id="layout"> <header class="text-center"><h4>flexbox layout</h4></header> - <section> + <section class="notes"> <p><strong>layout.less</strong> includes flexbox based grid system with 12 columns. </p> + <p>Add the class <span class="label">columns</span> to a container. Add any element you want with class <span class="label">column</span> inside the container. These columns will take up the space equally. You can specific the width of each column by adding class <span class="label">col-[1-12]</span>.</p> </section> <div class="columns"> <div class="column"> @@ -144,7 +150,11 @@ <section id="tables"> <header class="text-center"><h4>tables</h4></header> - <table> + <section class="notes"> + <p><strong>tables.less</strong> sets default styles for tables and data sets.</p> + <p>Add the class <span class="label"><table></span> to any table element. The class will add padding, border and emphasized table header. Adding the class <span class="label">selected</span> to a <tr> element will highlight the whole table row. </p> + </section> + <table class="table"> <thead> <tr> <th>name</th> @@ -184,8 +194,9 @@ <section id="buttons"> <header class="text-center"><h4>buttons</h4></header> - <section> - <p><strong>buttons.less</strong> includes simple button style for actions in different types and sizes. Buttons can show loading indicators. </p> + <section class="notes"> + <p><strong>buttons.less</strong> includes simple button style for actions in different types and sizes. </p> + <p>Add the class <span class="label">btn</span> to <a>, <input> or <button> elements for a default button. There are classes <span class="label">btn-primary</span> and <span class="label">btn-link</span> for predefined primary and link buttons. A button with the class <span class="label">loading</span> can show loading indicator. </p> </section> <div class="columns"> <div class="column"> @@ -197,16 +208,19 @@ <button class="btn btn-link loading">link button</button> </div> </div> + <header class="text-center"><h5>button sizes</h5></header> + <section class="notes"> + <p>Add the class <span class="label">btn-sm</span> or <span class="label">btn-lg</span> for small or large size. Also, you can add the class <span class="label">btn-block</span> for a full-width button.</p> + </section> <div class="columns"> <div class="column"> - <button class="btn btn-sm">small button</button> - <button class="btn btn-sm"><span class="icon icon-markunread"></span> small button</button> - <button class="btn">normal button</button> - <button class="btn"><span class="icon icon-markunread"></span> normal button</button> <button class="btn btn-lg">large button</button> <button class="btn btn-lg"><span class="icon icon-markunread"></span> large button</button> + <button class="btn btn-primary">normal button</button> + <button class="btn btn-primary"><span class="icon icon-markunread"></span> normal button</button> + <button class="btn btn-sm">small button</button> + <button class="btn btn-sm"><span class="icon icon-markunread"></span> small button</button> </div> - </div> <div class="columns"> <div class="column"> @@ -217,6 +231,9 @@ <section id="button-groups"> <header class="text-center"><h4>button groups</h4></header> + <section class="notes"> + <p>If you want to use buttons as a group, add the class <span class="label">btn-group</span> to the container. </p> + </section> <div class="columns"> <div class="column"> <div class="btn-group"> @@ -479,7 +496,7 @@ <section id="fileicons"> <header class="text-center"><h4>file icons</h4></header> - <section> + <section class="notes"> <p><strong>fileicons.less</strong> includes a set of file icons. This part is written entirely in CSS as well. </p> </section> <div class="columns"> @@ -498,8 +515,9 @@ <section id="tooltips"> <header class="text-center"><h4>tooltips</h4></header> - <section> - <p><strong>tooltips.less</strong> is built entirely in CSS. Add the attribute <span class="highlight">data-tooltip</span> and class <span class="highlight">tooltip</span> to non self closing elements. And add the class name <span class="highlight">tooltip-right, tooltip-bottom or tooltip-left</span> to define the position of a tooltip. By default, the tooltip appears above the element.</p> + <section class="notes"> + <p><strong>tooltips.less</strong> is a label-like component that appears on hover and focus.</p> + <p>Add the class <span class="label">tooltip</span> and the attribute <span class="label">data-tooltip</span>, which contains the tooltip content, to non self closing elements. And add the class name <span class="label">tooltip-right</span>, <span class="label">tooltip-bottom</span> or <span class="label">tooltip-left</span> to define the position of a tooltip. By default, the tooltip appears above the element.</p> <code><button class="btn btn-primary tooltip tooltip-right" data-tooltip="Lorem ipsum dolor sit amet">right tooltip</button></code> </section> <div class="columns"> @@ -553,13 +571,13 @@ <div class="columns"> <div class="column"> <div class="toast"> - <button class="btn-clear pull-right"></button> + <button class="btn btn-clear pull-right"></button> <span class="icon icon-error_outline"></span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div> </div> <div class="column"> <div class="toast toast-primary"> - <button class="btn-clear pull-right"></button> + <button class="btn btn-clear pull-right"></button> <span class="icon icon-error_outline"></span> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </div> </div> @@ -567,25 +585,25 @@ <div class="columns"> <div class="column"> <div class="toast toast-success"> - <button class="btn-clear pull-right"></button> + <button class="btn btn-clear pull-right"></button> Efficiently unleash cross-media information without cross-media value. </div> </div> <div class="column"> <div class="toast toast-info"> - <button class="btn-clear pull-right"></button> + <button class="btn btn-clear pull-right"></button> Efficiently unleash cross-media information without cross-media value. </div> </div> <div class="column"> <div class="toast toast-warning"> - <button class="btn-clear pull-right"></button> + <button class="btn btn-clear pull-right"></button> Efficiently unleash cross-media information without cross-media value. </div> </div> <div class="column"> <div class="toast toast-danger"> - <button class="btn-clear pull-right"></button> + <button class="btn btn-clear pull-right"></button> Efficiently unleash cross-media information without cross-media value. </div> </div> diff --git a/dist/spectre.css b/dist/spectre.css index b7002db..d197a20 100644 --- a/dist/spectre.css +++ b/dist/spectre.css @@ -460,9 +460,9 @@ pre { display: block; margin-top: 1em; margin-bottom: 1em; - border-left: .2rem solid #ddd; + border-left: 0.2rem solid #5764c6; line-height: 1.8rem; - background-color: #efefef; + background-color: #f9f9f9; } code { padding: 1rem 2rem; @@ -639,23 +639,22 @@ ol ol { max-width: 100%; height: auto; } -table { +.table { width: 100%; } -table th, -table td { +.table th, +.table td { text-align: left; padding: 1.5rem 1rem; border-bottom: 0.1rem solid #efefef; } -table th { +.table th { border-color: #c9c9c9; } -table tr.selected { +.table tr.selected { background-color: #f4f4f4; } -.btn, -button { +.btn { display: inline-block; height: 3.2rem; padding: .7rem 1.5rem; @@ -678,27 +677,21 @@ button { outline: 0; } .btn:hover, -button:hover, -.btn:focus, -button:focus { +.btn:focus { color: #fff; background-color: #5764c6; } .btn:active, -button:active, -.btn.active, -button.active { +.btn.active { color: #fff; background-color: #4452c0; } -.btn.loading, -button.loading { +.btn.loading { color: transparent !important; position: relative; pointer-events: none; } -.btn.loading::after, -button.loading::after { +.btn.loading::after { border: 2px solid #5764c6; border-right-color: transparent; border-top-color: transparent; @@ -716,79 +709,64 @@ button.loading::after { animation: loading 500ms infinite linear; } .btn[disabled], -button[disabled] { +.btn .disabled { opacity: .5; cursor: default; } -.btn.btn-primary, -button.btn-primary { +.btn.btn-primary { color: #fff; border-color: #4452c0; background-color: #5764c6; } .btn.btn-primary:hover, -button.btn-primary:hover, -.btn.btn-primary:focus, -button.btn-primary:focus { +.btn.btn-primary:focus { color: #fff; border-color: #3b49af; background-color: #4452c0; } .btn.btn-primary:active, -button.btn-primary:active, -.btn.btn-primary.active, -button.btn-primary.active { +.btn.btn-primary.active { color: #fff; border-color: #3b49af; background-color: #3b49af; } -.btn.btn-primary.loading::after, -button.btn-primary.loading::after { +.btn.btn-primary.loading::after { border-color: #fff; border-right-color: transparent; border-top-color: transparent; } -.btn.btn-link, -button.btn-link { +.btn.btn-link { color: #5764c6; border-color: transparent; background-color: transparent; } .btn.btn-link:hover, -button.btn-link:hover, -.btn.btn-link:focus, -button.btn-link:focus { +.btn.btn-link:focus { color: #35419c; } .btn.btn-link:active, -button.btn-link:active, -.btn.btn-link.active, -button.btn-link.active { +.btn.btn-link.active { color: #283176; } -.btn.btn-sm, -button.btn-sm { +.btn.btn-sm { height: 2.4rem; border-radius: 2px; font-size: 1.2rem; line-height: 1.4rem; padding: .4rem 1rem; } -.btn.btn-lg, -button.btn-lg { +.btn.btn-lg { height: 4.2rem; border-radius: 4px; font-size: 1.8rem; line-height: 2rem; padding: 1rem 1.8rem; } -.btn.btn-block, -button.btn-block { +.btn.btn-block { width: 100%; display: block; } -.btn.btn-clear, -button.btn-clear { +.btn.btn-clear { width: 1.4rem; height: 1.4rem; padding: 0; @@ -801,14 +779,11 @@ button.btn-clear { -webkit-transform: rotate(-45deg); transform: rotate(-45deg); } -.btn.btn-clear:hover, -button.btn-clear:hover { +.btn.btn-clear:hover { opacity: .75; } .btn.btn-clear::before, -button.btn-clear::before, -.btn.btn-clear::after, -button.btn-clear::after { +.btn.btn-clear::after { content: ""; display: block; position: absolute; @@ -816,15 +791,13 @@ button.btn-clear::after { left: 50%; background-color: #333; } -.btn.btn-clear::before, -button.btn-clear::before { +.btn.btn-clear::before { width: 1rem; height: .2rem; margin-left: -0.5rem; margin-top: -0.1rem; } -.btn.btn-clear::after, -button.btn-clear::after { +.btn.btn-clear::after { width: .2rem; height: 1rem; margin-left: -0.1rem; @@ -1093,6 +1066,13 @@ textarea.form-input { border-radius: .3rem; background-color: #efefef; } +.input-group .input-group-addon, +.input-group .input-group-btn { + -webkit-box-flex: 1; + -webkit-flex: 1 0 auto; + -ms-flex: 1 0 auto; + flex: 1 0 auto; +} .input-group .form-input:first-child:not(:last-child), .input-group .input-group-addon:first-child:not(:last-child), .input-group .input-group-btn:first-child:not(:last-child) { @@ -1328,15 +1308,15 @@ textarea.form-input { } .label { display: inline-block; - padding: .3rem .5rem; - font-size: 80%; - line-height: 1; - color: #666; + padding: .3rem .4rem; + font-size: 90%; + line-height: 1em; + color: #737373; background-color: #efefef; text-align: center; white-space: nowrap; vertical-align: middle; - margin: -0.3rem 0.5rem 0 0.5rem; + margin: -0.3rem 0.1em 0 0.1em; border-radius: .2rem; } .label.label-primary { @@ -1362,7 +1342,7 @@ textarea.form-input { .label.label-lg { font-size: 100%; line-height: 1.2; - padding: .3rem .8rem; + padding: .3rem .5rem; } .menu { display: block; @@ -1602,7 +1582,8 @@ textarea.form-input { -webkit-transition: all .216s ease; transition: all .216s ease; } -.tooltip:hover::after { +.tooltip:hover::after, +.tooltip:focus::after { opacity: 1; -webkit-transform: translate(-50%, -0.5rem); transform: translate(-50%, -0.5rem); @@ -1613,7 +1594,8 @@ textarea.form-input { -webkit-transform: translate(0, 50%); transform: translate(0, 50%); } -.tooltip.tooltip-right:hover::after { +.tooltip.tooltip-right:hover::after, +.tooltip.tooltip-right:focus::after { -webkit-transform: translate(0.5rem, 50%); transform: translate(0.5rem, 50%); } @@ -1623,7 +1605,8 @@ textarea.form-input { -webkit-transform: translate(-50%, 0); transform: translate(-50%, 0); } -.tooltip.tooltip-bottom:hover::after { +.tooltip.tooltip-bottom:hover::after, +.tooltip.tooltip-bottom:focus::after { -webkit-transform: translate(-50%, 0.5rem); transform: translate(-50%, 0.5rem); } @@ -1634,7 +1617,8 @@ textarea.form-input { -webkit-transform: translate(0, 50%); transform: translate(0, 50%); } -.tooltip.tooltip-left:hover::after { +.tooltip.tooltip-left:hover::after, +.tooltip.tooltip-left:focus::after { -webkit-transform: translate(-0.5rem, 50%); transform: translate(-0.5rem, 50%); } diff --git a/src/buttons.less b/src/buttons.less index ef95627..47f10ff 100644 --- a/src/buttons.less +++ b/src/buttons.less @@ -1,6 +1,5 @@ // Buttons -.btn, -button { +.btn { display: inline-block; height: 3.2rem; padding: .7rem 1.5rem; @@ -53,7 +52,8 @@ button { } } - &[disabled] { + &[disabled], + .disabled { opacity: .5; cursor: default; } diff --git a/src/forms.less b/src/forms.less index eaab29d..996056c 100644 --- a/src/forms.less +++ b/src/forms.less @@ -262,6 +262,10 @@ border-radius: .3rem; background-color: @core-border-color; } + .input-group-addon, + .input-group-btn { + flex: 1 0 auto; + } .form-input, .input-group-addon, diff --git a/src/labels.less b/src/labels.less index ac11630..1c16f40 100644 --- a/src/labels.less +++ b/src/labels.less @@ -1,15 +1,15 @@ // Labels .label { display: inline-block; - padding: .3rem .5rem; - font-size: 80%; - line-height: 1; - color: #666; + padding: .3rem .4rem; + font-size: 90%; + line-height: 1em; + color: lighten(@body-font-color, 25%); background-color: @core-border-color; text-align: center; white-space: nowrap; vertical-align: middle; - margin: -.3rem .5rem 0 .5rem; + margin: -.3rem .1em 0 .1em; border-radius: .2rem; &.label-primary { @@ -36,6 +36,6 @@ &.label-lg { font-size: 100%; line-height: 1.2; - padding: .3rem .8rem; + padding: .3rem .5rem; } }
\ No newline at end of file diff --git a/src/tables.less b/src/tables.less index 920f488..6ad7b93 100644 --- a/src/tables.less +++ b/src/tables.less @@ -1,5 +1,5 @@ // Tables -table { +.table { width: 100%; th, diff --git a/src/tooltips.less b/src/tooltips.less index 1ccc98b..ab3e754 100644 --- a/src/tooltips.less +++ b/src/tooltips.less @@ -23,7 +23,8 @@ pointer-events: none; transition: all .216s ease; } - &:hover { + &:hover, + &:focus { &::after { opacity: 1; transform: translate(-50%, -.5rem); @@ -36,7 +37,8 @@ left: 100%; transform: translate(0, 50%); } - &:hover { + &:hover, + &:focus { &::after { transform: translate(.5rem, 50%); } @@ -48,7 +50,8 @@ bottom: auto; transform: translate(-50%, 0); } - &:hover { + &:hover, + &:focus { &::after { transform: translate(-50%, .5rem); } @@ -61,7 +64,8 @@ left: auto; transform: translate(0, 50%); } - &:hover { + &:hover, + &:focus { &::after { transform: translate(-.5rem, 50%); } diff --git a/src/typography.less b/src/typography.less index 4a9476f..bd4c576 100644 --- a/src/typography.less +++ b/src/typography.less @@ -55,9 +55,9 @@ pre { display: block; margin-top: 1em; margin-bottom: 1em; - border-left: .2rem solid #ddd; + border-left: .2rem solid @core-color; line-height: 1.8rem; - background-color: @core-border-color; + background-color: lighten(@core-border-color, 4%); } code { padding: 1rem 2rem; |