This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Board } from "./go"; | |
describe("go", () => { | |
test("creates 19 x 19 board", () => { | |
const board = new Board(); | |
for (let i = 0; i < 19; i++) { | |
for (let j = 0; j < 19; j++) { | |
const space = board.getSpace(i, j); | |
expect([space.row, space.col]).toEqual([i, j]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Stars = function (props) { | |
var rating = props.rating || 0; // rating from 0 to 5, inclusive, in increments of 0.5 | |
var label = props.label || null; // a label to describe the contents (for accessibility) | |
var src = "./img/stars_" + rating + ".svg"; | |
return <img src={src} width="78" height="13" aria-label={label} data-tooltip={label}/>; | |
}; | |
module.exports = Stars; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Stars = function (props) { | |
var { | |
idx = 0, // the index of this instance, as we only need to genenerate the <map> once! | |
rating = 0, // rating from 0 to 5, inclusive, in increments of 0.5 | |
color = "#f6b85c", // the fill color | |
label = null // a label to describe the contents (for accessibility) | |
} = props; | |
var step = 18; | |
var scale = 0.13; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Gauge = function (props) { | |
var { | |
percent = 0, // a number between 0 and 1, inclusive | |
width = 100, // the overall width | |
height = 10, // the overall height | |
color = "#0078bc", // the fill color | |
animate = false, // if true, animate when the percent changes | |
label = null // a label to describe the contents (for accessibility) | |
} = props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Meter = function (props) { | |
var { | |
percent = 0, // a number between 0 and 1, inclusive | |
width = 100, // the overall width | |
height = 10, // the overall height | |
rounded = true, // if true, use rounded corners | |
color = "#0078bc", // the fill color | |
animate = false, // if true, animate when the percent changes | |
label = null // a label to describe the contents (for accessibility) | |
} = props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bubble = function (props) { | |
var { | |
percent = 0, // a number between 0 and 1, inclusive | |
size = 20, // the width and height of the bubble | |
color = "#0078bc", // the fill color | |
label = null // a label to describe the contents (for accessibility) | |
} = props; | |
var c = size / 2; | |
var r = Math.sqrt(Math.pow(c, 2) * percent); |