Skip to content

Commit 10c85a3

Browse files
committed
Refactor icon rendering
1 parent 3cade33 commit 10c85a3

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

frameworks/keyed/rendrjs/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/rendrjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"webpack-cli": "5.1.4"
1111
},
1212
"dependencies": {
13-
"@rendrjs/core": "0.1.202"
13+
"@rendrjs/core": "0.1.205"
1414
},
1515
"js-framework-benchmark": {
1616
"frameworkVersionFromPackage": "@rendrjs/core",

frameworks/keyed/rendrjs/src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { rendr, useState } from '@rendrjs/core';
22
import { Jumbotron } from './Jumbotron';
33
import { Row } from './Row';
4-
import { RemoveIcon } from './RemoveIcon';
4+
import { makeIcon } from './RemoveIcon';
55

66
let random = (max) => Math.round(Math.random() * 1000) % max;
77

@@ -29,7 +29,7 @@ let buildData = (count) => {
2929
return data;
3030
};
3131

32-
export let preloadIcon = rendr(RemoveIcon, { pre: true });
32+
export let preloadIcon = makeIcon(true);
3333

3434
export let App = () => {
3535
let [state, setState] = useState({ arr: [], sel: 0 });
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { rendr } from '@rendrjs/core';
22

3-
export let RemoveIcon = ({ pre }) => rendr('span', {
4-
class: `${pre ? 'preloadicon ' : ''}glyphicon glyphicon-remove`,
5-
'aria-hidden': true,
3+
export let makeIcon = preload => rendr('span', {
4+
class: `${preload ? 'preloadicon ' : ''}glyphicon glyphicon-remove`,
5+
ariaHidden: true,
66
});

frameworks/keyed/rendrjs/src/Row.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { rendr } from '@rendrjs/core';
22
import { colMd1, colMd4, colMd6 } from './classes';
3-
import { RemoveIcon } from './RemoveIcon';
3+
import { makeIcon } from './RemoveIcon';
4+
5+
let icon = makeIcon();
46

57
export let Row = ({ hi, sel, item, del }) => {
68
return rendr('tr', {
@@ -21,7 +23,7 @@ export let Row = ({ hi, sel, item, del }) => {
2123
class: colMd1,
2224
slot: rendr('a', {
2325
onclick: () => del(item.id),
24-
slot: rendr(RemoveIcon, {}),
26+
slot: icon,
2527
}),
2628
}),
2729
rendr('td', { class: colMd6 }),

0 commit comments

Comments
 (0)