Skip to content

Commit 9ef325b

Browse files
authored
Dynamic height in NestedRow component (#187)
* Dynamic height if necessary * Updated tests * Prettier config
1 parent fd7ac79 commit 9ef325b

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
- run: yarn install
1010
- run: yarn tslint
1111
- run: yarn type-check
12-
- run: yarn test
12+
- run: yarn test-coverage

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"prettier.configPath": "prettier.config.js"
3+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
77
"scripts": {
8-
"test": "jest && codecov",
8+
"test": "jest",
9+
"test-coverage": "jest && codecov",
910
"tslint": "tslint -p .",
1011
"type-check": "tsc --noEmit",
1112
"prepublishOnly": "tsc -p ./ --outDir dist/",

prettier.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
trailingComma: 'es5',
3-
tabWidth: 2,
3+
tabWidth: 4,
44
semi: false,
55
singleQuote: true,
66
bracketSpacing: false,

src/NestedRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface IProps {
2121

2222
const NestedRow = React.memo(
2323
({
24-
height = 50,
24+
height,
2525
children,
2626
level = 0,
2727
paddingLeftIncrement = 10,
@@ -32,9 +32,9 @@ const NestedRow = React.memo(
3232
styles.nestedRow,
3333
{
3434
...style,
35-
height,
3635
paddingLeft: level * paddingLeftIncrement,
3736
},
37+
height ? {height} : {},
3838
]}
3939
>
4040
{children}

src/__snapshots__/NestedListView.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ exports[`NestedListView renders with NestedRow 1`] = `
168168
"justifyContent": "center",
169169
},
170170
Object {
171-
"height": 50,
172171
"paddingLeft": 10,
173172
},
173+
Object {},
174174
]
175175
}
176176
/>
@@ -199,9 +199,9 @@ exports[`NestedListView renders with NestedRow 1`] = `
199199
"justifyContent": "center",
200200
},
201201
Object {
202-
"height": 50,
203202
"paddingLeft": 10,
204203
},
204+
Object {},
205205
]
206206
}
207207
/>
@@ -230,9 +230,9 @@ exports[`NestedListView renders with NestedRow 1`] = `
230230
"justifyContent": "center",
231231
},
232232
Object {
233-
"height": 50,
234233
"paddingLeft": 10,
235234
},
235+
Object {},
236236
]
237237
}
238238
/>

src/__snapshots__/NestedRow.test.tsx.snap

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ exports[`NestedListView renders customised 1`] = `
1111
Object {
1212
"borderColor": "black",
1313
"borderWidth": 1,
14-
"height": 60,
1514
"paddingLeft": 15,
1615
},
16+
Object {
17+
"height": 60,
18+
},
1719
]
1820
}
1921
>
@@ -34,9 +36,9 @@ exports[`NestedListView renders with simple array 1`] = `
3436
Object {
3537
"borderColor": "black",
3638
"borderWidth": 1,
37-
"height": 50,
3839
"paddingLeft": 10,
3940
},
41+
Object {},
4042
]
4143
}
4244
>
@@ -57,9 +59,9 @@ exports[`NestedListView renders with simple array without level 1`] = `
5759
Object {
5860
"borderColor": "black",
5961
"borderWidth": 1,
60-
"height": 50,
6162
"paddingLeft": 0,
6263
},
64+
Object {},
6365
]
6466
}
6567
>

0 commit comments

Comments
 (0)