shareon-pulsanti-condivisio.../src/networksMixin.js

24 lines
614 B
JavaScript
Raw Normal View History

2022-02-08 18:56:39 +01:00
const { fullNetworkMap } = require("./networks");
2020-07-31 18:54:43 +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}`] = {
2022-02-08 18:56:39 +01:00
"background-color": network.color,
2020-07-31 18:54:43 +02:00
};
ruleObj[`.shareon > *.${name}::before`] = {
2022-02-08 18:56:39 +01:00
"background-image": `url('${network.icon}')`,
2020-07-31 18:54:43 +02:00
};
2022-02-08 18:56:39 +01:00
if (Object.prototype.hasOwnProperty.call(network, "iconWhenText")) {
2020-07-31 18:54:43 +02:00
ruleObj[`.shareon > *.${name}:not(:empty)::before`] = {
2022-02-08 18:56:39 +01:00
"background-image": `url('${network.iconWhenText}')`,
2020-07-31 18:54:43 +02:00
};
}
});
return ruleObj;
};