Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Component: Meter Styling #73

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a2f2507
Component: Meter Styling
Apr 18, 2015
9a3af8b
Component: Meter Styling
Noufal21 Apr 18, 2015
25d5cb2
Merge branch '71-base-styling-for-meter' of https://github.com/Noufal…
Noufal21 Apr 18, 2015
82732e5
Component: Meter
Noufal21 Apr 18, 2015
5b44e94
Component: Meter
Noufal21 Apr 18, 2015
05b7cef
Component: Meter
Noufal21 Apr 18, 2015
6834d28
Component: Meter
Noufal21 Apr 18, 2015
f4d3b38
Component: Meter
Noufal21 Apr 21, 2015
c6d38bc
Component: Meter
Noufal21 Apr 21, 2015
4f6d7ba
Component: Meter
Noufal21 Apr 21, 2015
3fe19f4
Component: Meter
Noufal21 Apr 22, 2015
657c890
Component: Meter
Noufal21 Apr 22, 2015
f8edb99
Component:Meter
Noufal21 Apr 22, 2015
8736b7f
component: meter
Noufal21 Apr 28, 2015
cdbe43b
component: Meter
Noufal21 Apr 28, 2015
e60d820
component: Meter
Noufal21 Apr 28, 2015
61bb3b4
Component: Meter
Noufal21 Apr 30, 2015
ca93823
Component: Meter
Noufal21 Apr 30, 2015
42cf9ef
Component:Meter
Noufal21 May 3, 2015
b791b91
component:meter
Noufal21 May 3, 2015
0e866ff
Component: Meter
Noufal21 May 4, 2015
4608cdc
Component: Meter
Noufal21 May 4, 2015
5dbdef6
Component: Meter
Noufal21 May 4, 2015
3565924
component: Meter
Noufal21 May 4, 2015
a111870
Update Meter.html
Noufal21 May 4, 2015
3f04bfc
Component:Meter
Noufal21 May 4, 2015
ab7a731
Update Meter.html
Noufal21 May 4, 2015
6cc28a7
Rename _Meter.scss to _meter.scss
Noufal21 May 4, 2015
7345eb9
Component: Meter
Noufal21 May 4, 2015
189024d
Component: Meter
Noufal21 May 4, 2015
f95e683
Component: Meter
Noufal21 May 5, 2015
00ac522
Component:Meter
Noufal21 May 5, 2015
ff4266c
Component:Meter
Noufal21 May 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions demo/meter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Chassis - Meter</title>
<link rel="stylesheet" href="../dist/css/chassis.css">
</head>
<body>
<meter max="100" value="50" class="meter-simple"></meter>
<meter max="100" value="100" class="meter-multicolor"></meter>
<meter max="100" value="50" class="meter-strip"></meter>
</body>
</html>
114 changes: 114 additions & 0 deletions scss/atoms/meter/_meter.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* ==========================================================================
* meter
* ==========================================================================
*/

@import
"variables";

meter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need a blank line above the meter {

-webkit-appearance: none;
-moz-appearance: none;
width: 550px;
height: 25px;
margin:10px;
display:block;
box-shadow: inset 0 0 7px -2px rgba(0,0,0,0.35);
background: $meterbar-background-color;
}

.meter-simple::-webkit-meter-bar,
.meter-multicolor::-webkit-meter-bar,
.meter-strip::-webkit-meter-bar {
box-shadow: inset 0 0 7px -2px rgba(0,0,0,0.35);
background: $meterbar-background-color;
}

.meter-simple::-webkit-meter-optimum-value {
background: $chassis-blue;
}


.meter-multicolor::-webkit-meter-optimum-value {
background-image: linear-gradient(
90deg,
adjust-saturation($color , $percentage) 10%,
adjust-saturation($color , $percentage - 5%) 10%,
adjust-saturation($color , $percentage - 5%) 20%,
adjust-saturation($color , $percentage - 10%) 20%,
adjust-saturation($color , $percentage - 10%) 30%,
adjust-saturation($color , $percentage - 15%) 30%,
adjust-saturation($color , $percentage - 15%) 40%,
adjust-saturation($color , $percentage - 20%) 40%,
adjust-saturation($color , $percentage - 20%) 50%,
adjust-saturation($color , $percentage - 25%) 50%,
adjust-saturation($color , $percentage - 25%) 60%,
adjust-saturation($color , $percentage - 30%) 60%,
adjust-saturation($color , $percentage - 30%) 70%,
adjust-saturation($color , $percentage - 35%) 70%,
adjust-saturation($color , $percentage - 35%) 80%,
adjust-saturation($color , $percentage - 40%) 80%,
adjust-saturation($color , $percentage - 40%) 90%,
adjust-saturation($color , $percentage - 45%) 90%,
adjust-saturation($color , $percentage - 45%) 100%
);
background-size: 100% 100%;
}

.meter-strip::-webkit-meter-optimum-value {
background-image: linear-gradient(
135deg,
transparent,
transparent 33%,
$chassis-blue 33%,
$chassis-blue 66%,
transparent 66%
);
background-size: 50px 25px;
}



.meter-simple:-moz-meter-optimum::-moz-meter-bar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the contents of this selector are basically a direct copy of what you have in webkit implementation above (line 31). Why not just list both selectors up above once so you're not repeating the same contents multiple times in your scss file? It will help make customization easier.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, this won't work because firefox/chrome will read part of the selector as being invalid css and ignore it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfrisk what I do style the meter or progress bar with div tags?

background: $chassis-blue;
}


.meter-multicolor:-moz-meter-optimum::-moz-meter-bar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the contents of this selector are basically a direct copy of what you have in webkit implementation above (line 36). Why not just list both selectors up above once so you're not repeating the same contents multiple times in your scss file? It will help make customization easier.

background-image: linear-gradient(
90deg,
adjust-saturation($color , $percentage) 10%,
adjust-saturation($color , $percentage - 5%) 10%,
adjust-saturation($color , $percentage - 5%) 20%,
adjust-saturation($color , $percentage - 10%) 20%,
adjust-saturation($color , $percentage - 10%) 30%,
adjust-saturation($color , $percentage - 15%) 30%,
adjust-saturation($color , $percentage - 15%) 40%,
adjust-saturation($color , $percentage - 20%) 40%,
adjust-saturation($color , $percentage - 20%) 50%,
adjust-saturation($color , $percentage - 25%) 50%,
adjust-saturation($color , $percentage - 25%) 60%,
adjust-saturation($color , $percentage - 30%) 60%,
adjust-saturation($color , $percentage - 30%) 70%,
adjust-saturation($color , $percentage - 35%) 70%,
adjust-saturation($color , $percentage - 35%) 80%,
adjust-saturation($color , $percentage - 40%) 80%,
adjust-saturation($color , $percentage - 40%) 90%,
adjust-saturation($color , $percentage - 45%) 90%,
adjust-saturation($color , $percentage - 45%) 100%
);
background-size: 100% 100%;
}

.meter-strip:-moz-meter-optimum::-moz-meter-bar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the contents of this selector are basically a direct copy of what you have in webkit implementation above (line 62). Why not just list both selectors up above once so you're not repeating the same contents multiple times in your scss file? It will help make customization easier.

background-image: linear-gradient(
135deg,
transparent,
transparent 33%,
$chassis-blue 33%,
$chassis-blue 66%,
transparent 66%
);
background-size: 50px 25px;
}
20 changes: 20 additions & 0 deletions scss/atoms/meter/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* ==========================================================================
* meter variables
* ==========================================================================
*/
$chassis-blue: #37bfc9;
$meterbar-background-color: #f1f1f1;


/*
* For multi color Meter bar
* Scales $color's saturation value by $amount. $amount can be negative.
* scale-saturation($color, $amount)
*/

/* This is the staring color, whose the saturation increse with percentage. */
$color: #3ee3ef;

/* The starting percentage, which increse the saturation of the color. */
$percentage: 0;
3 changes: 2 additions & 1 deletion scss/lint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

@import
"atoms/icons/icons",
"atoms/typography/typography";
"atoms/typography/typography",
"atoms/meter/meter";

@import
"views/main";