Testing out a Redux action that makes a circle active on a click event, based on Philippe Rivière’s Redux + D3 in the browser block
xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<!-- https://www.basscss.com/ -->
<link href="https://unpkg.com/basscss@8.0.2/css/basscss.min.css" rel="stylesheet">
<style>
body {
background: #a634a0;
font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, Consolas, monaco, monospace;
}
button.btn {
font-family : inherit;
font-size: 16px;
letter-spacing: 2px;
font-weight: 700;
font-weight: 500;
cursor: pointer;
display: inline-block;
padding: .5rem 1rem;
height: auto;
border: 1px solid transparent;
vertical-align: middle;
-webkit-appearance: none;
color: inherit;
background-color: transparent;
text-decoration: none;
}
button.btn-primary {
color: #fff;
background-color: #6b2167;
border-radius: 3px;
}
button.btn-primary:hover {
box-shadow: inset 0 0 0 20rem #952e90;
}
</style>
</head>
<body>
<header class="pl2">
<p>Click on circle to set state via a Redux action</p>
</header>
<svg width="960" height="200">
<g id="vis" transform="translate(10, 10)"></g>
</svg>
<nav class="pl2">
<button class="btn btn-primary">RESET</button>
</nav>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.7.2/redux.min.js"></script>
<!-- d3 code -->
<script src=".script-compiled.js" charset="utf-8"></script>
</body>
</html>
https://d3js.org/d3.v4.min.js
https://cdnjs.cloudflare.com/ajax/libs/redux/3.7.2/redux.min.js