Skip to content

Commit

Permalink
feat(box): Removed extra CSS classes from Box.modules.scss
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcabrera committed Nov 9, 2017
1 parent 304216b commit 7b05150
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
37 changes: 16 additions & 21 deletions src/components/Box/Box.modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ $responsive-spacings: (
)
);

$boxProps: ('margin': 'Margin', 'padding': 'Padding');

.betweenRight {
display: flex;
flex-direction: row;
Expand All @@ -35,29 +33,26 @@ $boxProps: ('margin': 'Margin', 'padding': 'Padding');

// Todo remove unneeded classes related to margin
@mixin spacingClasses ($level, $value) {
@each $p, $v in $boxProps {
.vertical#{$v}-#{$level} {
#{$p}-top: $value;
#{$p}-bottom: $value;
}
.verticalPadding-#{$level} {
padding-top: $value;
padding-bottom: $value;
}

.horizontal#{$v}-#{$level} {
#{$p}-left: $value;
#{$p}-right: $value;
}
.horizontalPadding-#{$level} {
padding-left: $value;
padding-right: $value;
}

.bottom#{$v}-#{$level} {
#{$p}-bottom: $value;
}
.bottomMargin-#{$level} {
margin-bottom: $value;
}

// TODO: refactor to not generate unnecessary .betweenBottomPadding-*
.betweenBottom#{$v}-#{$level} > *:not(:last-child) {
#{$p}-bottom: $value;
}
.betweenBottomMargin-#{$level} > *:not(:last-child) {
margin-bottom: $value;
}

.betweenRight#{$v}-#{$level} > *:not(:last-child) {
#{$p}-right: $value;
}
.betweenRightMargin-#{$level} > *:not(:last-child) {
margin-right: $value;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Input extends React.Component {
const showIcon = showFeedbackIcon(feedback, this.state.focus)

return (
<Box between={3}>
<Box between={2}>
<Flexbox direction="row" dangerouslyAddClassName={formFieldStyles.containsTooltip}>
{this.renderLabel(label, hint, inputId)}
{tooltip && React.cloneElement(tooltip, { connectedFieldLabel: label })}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Input/Input.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Use the `feedback` attribute to give the user feedback regarding their input. Yo
was correct, or highlight errors that must be corrected.

```
<div>
<Box between={2}>
<Input label="Username" value="guest12345" feedback="success" />
<Input
label="Email" value="guest@telus.com" feedback="error"
error="That email is already associated with another account. Choose another one."
/>
</div>
</Box>
```

TDS does not perform input validations, as that is an application level concern. You will need to track the value of your
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Input renders 1`] = `
<div
class="betweenBottomMargin-3"
class="betweenBottomMargin-2"
>
<div
class="row containsTooltip"
Expand Down Expand Up @@ -47,7 +47,7 @@ exports[`Input renders 1`] = `

exports[`Input renders with a feedback state and icon 1`] = `
<div
class="betweenBottomMargin-3"
class="betweenBottomMargin-2"
>
<div
class="row containsTooltip"
Expand Down

0 comments on commit 7b05150

Please sign in to comment.