Skip to content

Commit

Permalink
feat(badges): changes made that was asked by the reviewer
Browse files Browse the repository at this point in the history
Removed box-sizing and border none, and classes that changed the size. Added cursor fallback and
size change by the font-size. Changed from span to a; display type; margin.

#211
  • Loading branch information
guastallaigor committed Dec 20, 2018
1 parent f8a8e31 commit 911f281
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 33 deletions.
18 changes: 9 additions & 9 deletions docs/badge.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies
import { // eslint-disable-line import/no-extraneous-dependencies
withKnobs, radios, boolean,
withKnobs, radios, boolean, number
} from '@storybook/addon-knobs';

const stories = storiesOf('Badges', module);
Expand All @@ -23,17 +23,17 @@ stories.add('badges', () => {
'is-error': 'is-error',
}, 'is-success');

const sizes = radios('size', {
'is-small': 'is-small',
'is-medium': 'is-medium',
'is-large': 'is-large',
}, 'is-medium');
const fontSize = number('font-size', 1, {
range: true,
min: 0,
max: 100,
step: 0.01,
});

const isSplited = boolean('is-splited', true) ? 'is-splited' : '';
const selectedClasses = [sizes, isSplited].join(' ');

return `<span class="nes-badge ${selectedClasses}">
return `<a href="#" class="nes-badge ${isSplited}" style="font-size:${fontSize}em">
<span class="${optionsLeft}">npm</span>
<span class="${optionsRight}">1.0.0</span>
</span>`;
</a>`;
});
31 changes: 7 additions & 24 deletions scss/elements/badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,23 @@
}

@mixin setup($px) {
width: $px * 14;
height: $px;
font-size: $px * 1.2;
line-height: 1.5;
}

// Default style
.nes-badge {
$em: 0.75em;
width: $em * 14;
height: $em;
font-size: $em * 1.2;
position: relative;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
display: inline-block;
padding: 0.75em;
margin: 4px;
margin: 0.5em;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: $cursor-click-url;
cursor: $cursor-click-url, pointer;
user-select: none;
border: none;
@include setup(7px);

// Other styles
Expand All @@ -79,17 +75,4 @@
@include badge-style(nth($type, 2), nth($type, 3), false);
}
}

// Other sizes
// prettier-ignore
$sizes:
"small" 5px,
"medium" 7px,
"large" 9px;

@each $size in $sizes {
&.is-#{nth($size, 1)} {
@include setup(nth($size, 2));
}
}
}

0 comments on commit 911f281

Please sign in to comment.