Add mixin to populate CSS

This commit is contained in:
Nikita Karamov 2020-07-31 18:54:43 +02:00
parent f856eb3474
commit 65969039a4
No known key found for this signature in database
GPG Key ID: E40DFE6E993540FF
2 changed files with 25 additions and 0 deletions

23
src/networksMixin.js Normal file
View File

@ -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;
}

View File

@ -72,3 +72,5 @@
content: '';
vertical-align: bottom;
}
@mixin networks;