From 0f8d2df1aad4af3dbc5c07ea79fdef8dc3ba3082 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Wed, 9 Dec 2015 12:39:38 +0200 Subject: Masked bit styles --- index.js | 6 +++--- style.scss | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index fcb42e3..43f477a 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,8 @@ class IPAddress extends React.Component { constructor(props) { super(props) this.state = { - octets: [10, 88, 135, 24], - cidr: 32, + octets: [10, 88, 135, 144], + cidr: 28, } } @@ -54,7 +54,7 @@ class IPAddress extends React.Component {
    1. {[...Array(8)].map((x, bit) => -
    2. {(this.state.octets[octet] & (1 << (7-bit))) >> (7-bit)}
    3. +
    4. this.state.cidr-1 ? 'bit masked' : 'bit unmasked'}>{(this.state.octets[octet] & (1 << (7-bit))) >> (7-bit)}
    5. )}
  • diff --git a/style.scss b/style.scss index 477809c..1db93d8 100644 --- a/style.scss +++ b/style.scss @@ -59,10 +59,11 @@ body { border: 1px black solid; } } - &:nth-child(1) ol li.bit { background-color: lighten($color_a, $octet_lighten); } - &:nth-child(2) ol li.bit { background-color: lighten($color_b, $octet_lighten); } - &:nth-child(3) ol li.bit { background-color: lighten($color_c, $octet_lighten); } - &:nth-child(4) ol li.bit { background-color: lighten($color_d, $octet_lighten); } + &:nth-child(1) ol li.bit.unmasked { background-color: lighten($color_a, $octet_lighten); } + &:nth-child(2) ol li.bit.unmasked { background-color: lighten($color_b, $octet_lighten); } + &:nth-child(3) ol li.bit.unmasked { background-color: lighten($color_c, $octet_lighten); } + &:nth-child(4) ol li.bit.unmasked { background-color: lighten($color_d, $octet_lighten); } + ol li.bit.masked { background-color: lighten($color_e, $octet_lighten); } } } } -- cgit v1.3.1