2020-09-18 19:40:26 +02:00
|
|
|
const { fullNetworkMap } = require('./networks');
|
2020-07-31 18:54:43 +02:00
|
|
|
|
2020-09-18 19:40:26 +02:00
|
|
|
module.exports = function networks() {
|
2020-07-31 18:54:43 +02:00
|
|
|
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;
|
2020-09-18 19:40:26 +02:00
|
|
|
};
|