Add mixin to populate CSS
parent
f856eb3474
commit
65969039a4
|
@ -0,0 +1,23 @@
|
|||
import { fullNetworkMap } from './networks';
|
||||
|
||||
export default function networks() {
|
||||
const ruleObj = {};
|
||||
|
||||
Object.entries(fullNetworkMap).forEach(([name, network]) => {
|
||||
ruleObj[`.shareon > *.${name}`] = {
|
||||
'background-color': network.color,
|
||||
};
|
||||
|
||||
ruleObj[`.shareon > *.${name}::before`] = {
|
||||
'background-image': `url('${network.icon}')`,
|
||||
};
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(network, 'iconWhenText')) {
|
||||
ruleObj[`.shareon > *.${name}:not(:empty)::before`] = {
|
||||
'background-image': `url('${network.iconWhenText}')`,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return ruleObj;
|
||||
}
|
|
@ -72,3 +72,5 @@
|
|||
content: '';
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
@mixin networks;
|
||||
|
|
Loading…
Reference in New Issue