mirror of
https://github.com/NickKaramoff/shareon
synced 2025-03-10 00:10:15 +01:00
Add mixin to populate CSS
This commit is contained in:
parent
f856eb3474
commit
65969039a4
23
src/networksMixin.js
Normal file
23
src/networksMixin.js
Normal 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;
|
||||||
|
}
|
@ -72,3 +72,5 @@
|
|||||||
content: '';
|
content: '';
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin networks;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user