Electrum
Electrum simplifies framework-agnostic declaration of React components and is used
internally by Epsitec SA to bridge the gap with its
Xcraft toolchain and with its Lydia framework.
How to use Electrum
To include and configure Electrum in a JavaScript project, simply npm install electrum
.
Then:
var Electrum = require ('electrum');
var Lydia =
var Radium =
var E = new Electrum (Lydia, Radium);
var Component = E.createClass ({...});
var E = new Electrum ();
E.use (Lydia);
E.use (Radium);
var Component = E.createClass ({...});
var Component = new Electrum ()
.use (Lydia)
.use (Radium)
.createClass ({...});
Create React components with E.createClass({...})
as you normally would
with React.createClass({...})
. Electrum takes care of extending the provided
object, for instance to include a call to Radium.wrap()
, etc.
What will it do, besides createClass
?
This is not yet implemented in version 0.0.x
Electrum provides an entry point to the style objects used in conjunction with Radium.
Themes are broken down into distinct axes:
- Palette → color, gradients, filters, etc.
- Typography → fonts, spacing, padding, etc.
- Shape → corners, geometric properties, spacing, padding, etc.
- Animation → transitions, timings, etc.
These collection of partial styles and constants can be accessed through the palette
,
typo
, shape
and animation
Electrum properties.
Example (don't take it too seriously, though):
var boxStyles = [
E.palette.colors.box.background,
E.typo.title,
{
height: E.shape.defaultBarHeight,
opacity: 0.8,
':hover': {
height: E.shape.defaultBarHeight * 1.2,
opacity: 1.0,
transition: { height: E.animation.open, opacity: E.animation.pop }
}
}
];
Where does the name Electrum come from?
Electrum is an alloy of gold and silver used to
produce ancient Lydian coinage.
The first metal coins ever made, were of Electrum and date back to the end of the 7th century,
beginning of the 6th century BC.