Skip to content

Commit 76c4296

Browse files
committed
UI tweaks.
1 parent fed784e commit 76c4296

File tree

6 files changed

+63
-68
lines changed

6 files changed

+63
-68
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ This code uses HTML (with absolute positioning) rather than SVG, and has no depe
77
Check out [the demo](https://evoluteur.github.io/d3-table-cards/).
88

99

10-
(c) 2018 [Olivier Giulieri](https://evoluteur.github.io/) with [MIT license](http://github.com/evoluteur/d3-table-cards/blob/master/LICENSE.md).
10+
(c) 2019 [Olivier Giulieri](https://evoluteur.github.io/) with [MIT license](http://github.com/evoluteur/d3-table-cards/blob/master/LICENSE.md).

d3-table-cards.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
position: absolute;
99
padding: 10px;
1010
background-color: #eee;
11-
border: solid 1px silver;
11+
border: solid 2px silver;
1212
left: 0px;
1313
top: 0px;
1414
width: 574px;
@@ -26,11 +26,15 @@
2626
position: absolute;
2727
border: solid 1px silver;
2828
background-color: white;
29+
overflow: hidden;
2930
}
3031
.item > div{
3132
position: absolute;
3233
line-height: 18px;
3334
}
35+
.item > div:first-child{
36+
font-weight: bold;
37+
}
3438
.c1{
3539
font-weight: bold;
3640
}

d3-table-cards.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
var layoutInfo = {
55
table: {
66
// ---- row position & size
7-
top: function(d, i){return 40+i*29+'px'},
7+
top: function(d, i){return 40+i*31+'px'},
88
left: 0,
9-
height: 28,
10-
width: 590,
9+
height: 30,
10+
width: 594,
1111
// ---- row border-radius
1212
radius: 0,
1313
// ---- table header
@@ -23,12 +23,12 @@ var layoutInfo = {
2323
},
2424
cards: {
2525
// ---- card position & size
26-
top: function(d, i){return Math.floor(i/cardsPerRow)*90+'px'},
27-
left: function(d, i){return (i%cardsPerRow)*200+'px'},
28-
height: 80,
29-
width: 188,
26+
top: function(d, i){return Math.floor(i/cardsPerRow)*94+'px'},
27+
left: function(d, i){return (i%cardsPerRow)*210+'px'},
28+
height: 84,
29+
width: 200,
3030
// ---- card border-radius
31-
radius: '5px',
31+
radius: '4px',
3232
// ---- table header (hidden)
3333
headerOpacity: 0,
3434
headerLeft: -650,
@@ -37,21 +37,21 @@ var layoutInfo = {
3737
c1Left: 10,
3838
c1FontSize: 18,
3939
// ---- line 2
40-
c2Top: 37,
40+
c2Top: 38,
4141
c2Left: 10,
4242
}
4343
};
4444

4545
var selector = '.holder';
4646
var curStyle = 'cards'; // "table" or "cards"
47-
var animTime = 650;
47+
var animTime = 600;
4848

4949
var holder;
5050
var cardsPerRow = 3;
5151

5252
function getLayoutInfo(style){
53-
var width = window.innerWidth -20;
54-
cardsPerRow = Math.floor(width/200);
53+
var width = window.innerWidth -40;
54+
cardsPerRow = Math.floor(width/210);
5555
return layoutInfo[style];
5656
}
5757

@@ -127,8 +127,8 @@ function layout(skipAnim, skipChildren){
127127
.style('left', l.headerLeft);
128128

129129
var totalHeight = 20+(curStyle==='cards' ?
130-
Math.ceil(data.length/cardsPerRow)*90
131-
: 40+data.length*29);
130+
Math.ceil(data.length/cardsPerRow)*94
131+
: 40+data.length*31);
132132

133133
holder.transition(t)
134134
.style('height', totalHeight);

demo.css

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,61 @@
11

22
body{
3-
font-family: Arial, Helvetica, sans-serif;
4-
margin: 20px;
5-
min-height: 1250px;
6-
7-
color: black;
8-
background-color: white;
9-
background-image: url("bg.gif");
3+
font-family: 'Roboto',arial;
4+
min-height: 1250px;
5+
margin: 0;
6+
padding: 20px 20px 20px 30px;
7+
color: black;
8+
background-color: white;
109
}
10+
1111
h1{
1212
margin-bottom: 40px;
1313
}
1414
a {
15-
text-decoration: none;
16-
background-color: rgba(187,239,253,0.3);
17-
border-bottom: 1px solid rgba(0,0,0,0.2);
18-
color: #1a1a1a;
15+
text-decoration: none;
16+
color: #259DCB;
1917
}
2018
a:hover {
21-
background-color: #bbeffd;
22-
border-bottom-color: #1a1a1a;
19+
text-decoration: underline;
20+
color: navy;
2321
}
2422

2523
#opts{
2624
position: absolute;
2725
top: 10px;
2826
right: 20px;
2927
background-color: white;
28+
color: grey;
3029
}
3130
#opts > div{
3231
padding:5px;
3332
}
3433

35-
/* gemstones */
3634
.chakra1{
37-
border-left: solid 7px #f44336;
38-
}
39-
.chakra2{
40-
border-left: solid 7px #ff9800;
41-
}
42-
.chakra3{
43-
border-left: solid 7px #ffc107;
44-
}
45-
.chakra4{
46-
border-left: solid 7px #4caf50;
47-
}
48-
.chakra5{
49-
border-left: solid 7px #00bcd4;
50-
}
51-
.chakra6{
52-
border-left: solid 7px #3f51b5;
53-
}
54-
.chakra7{
55-
border-left: solid 7px #9c27b0;
56-
}
57-
/*
58-
.chakra1:hover{
5935
background-color: #ffebee;
36+
border: solid 2px #f44336;
6037
}
61-
.chakra2:hover{
38+
.chakra2{
6239
background-color: #fff3e0;
40+
border: solid 2px #ff9800;
6341
}
64-
.chakra3:hover{
42+
.chakra3{
6543
background-color: #fff8e1;
44+
border: solid 2px #ffc107;
6645
}
67-
.chakra4:hover{
46+
.chakra4{
6847
background-color: #e8f5e9;
48+
border: solid 2px #4caf50;
6949
}
70-
.chakra5:hover{
50+
.chakra5{
7151
background-color: #e0f7fa;
52+
border: solid 2px #00bcd4;
7253
}
73-
.chakra6:hover{
54+
.chakra6{
7455
background-color: #e8eaf6;
56+
border: solid 2px #3f51b5;
7557
}
76-
.chakra7:hover{
58+
.chakra7{
7759
background-color: #f3e5f5;
60+
border: solid 2px #9c27b0;
7861
}
79-
*/
80-

index.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
<meta name="keywords" content="d3 d3v4 js table card cards view javascript animation gemstones">
1313
</head>
1414
<body onresize="redraw()">
15-
1615
<h1>Gemstones Properties</h1>
17-
1816
<div id="opts">
1917
<div>View:
2018
<a href="javascript:redraw('table')">Table</a> /
@@ -25,26 +23,26 @@ <h1>Gemstones Properties</h1>
2523
<a href="javascript:sort('chakra')">Chakra</a>
2624
</div>
2725
</div>
28-
2926
<div class="holder">
3027
<div class="header sortable">
3128
<div onclick="sort('name')">Gemstone</div>
3229
<div onclick="sort('chakra')">Spiritual properties</div>
3330
</div>
3431
</div>
35-
3632
<script>
3733
window.onload = function(){
3834
render();
3935
}
4036
</script>
4137

38+
<p><br/></p>
39+
4240
<p>Code available at <a href="https://github.com/evoluteur/d3-table-cards">GitHub</a> under the MIT license.</p>
4341

44-
<p>Data from <a href="https://smile.amazon.com/dp/1844090671" target="crystals">Healing Crystals</a> by
42+
<p>Gemstones properties from <a href="https://smile.amazon.com/dp/1844090671" target="crystals">Healing Crystals</a> by
4543
Michael Gienger.</p>
4644

47-
<p>&#169; 2018 <a href="https://evoluteur.github.io/">Olivier Giulieri</a>.</p>
45+
<p>&#169; 2019 <a href="https://evoluteur.github.io/">Olivier Giulieri</a>.</p>
4846

4947
</body>
5048
</html>

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
{
22
"name": "d3-table-cards",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Table/Cards views using D3.js for animated transitions.",
55
"author": "Olivier Giulieri (https://evoluteur.github.io/)",
6+
"copyright": "(c) 2019 Olivier Giulieri",
67
"repository": {
78
"type": "git",
89
"url": "https://github.com/evoluteur/d3-table-cards.git"
910
},
1011
"license": "MIT",
1112
"homepage": "https://github.com/evoluteur/d3-table-cards",
1213
"bugs": "https://github.com/evoluteur/d3-table-cards/issues",
13-
"keywords": "d3 d3v4 transition javascript animation js table card cards view"
14+
"keywords": [
15+
"d3",
16+
"d3v4",
17+
"transition",
18+
"animation",
19+
"list",
20+
"table",
21+
"cards",
22+
"d3js",
23+
"javascript",
24+
"html"
25+
]
1426
}

0 commit comments

Comments
 (0)