Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed all issues related to RTL direction of Spectre #505

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/_accordions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
input:checked ~,
&[open] {
& .accordion-header {
.icon {
transform: rotate(90deg);
.icon {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selector should have depth of applicability no greater than 2, but was 3
Line contains trailing whitespace

@if $rtl == true {
transform: rotate(-90deg);
} @else {
transform: rotate(90deg);
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/_badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@
&::after {
position: absolute;
top: 0;
right: 0;
transform: translate(50%, -50%);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

@if $rtl == true {
left: 0;
transform: translate(-50%, -50%);
} @else {
right: 0;
transform: translate(50%, -50%);
}
}
}

Expand Down
22 changes: 18 additions & 4 deletions src/_bars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@
width: 0;

&:first-child {
border-bottom-left-radius: $border-radius;
border-top-left-radius: $border-radius;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

@if $rtl == true {
border-bottom-right-radius: $border-radius;
border-top-right-radius: $border-radius;
} @else {
border-bottom-left-radius: $border-radius;
border-top-left-radius: $border-radius;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

}
&:last-child {
border-bottom-right-radius: $border-radius;
border-top-right-radius: $border-radius;
flex-shrink: 1;

@if $rtl == true {
border-bottom-left-radius: $border-radius;
border-top-left-radius: $border-radius;
} @else {
border-bottom-right-radius: $border-radius;
border-top-right-radius: $border-radius;
}

}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/_breadcrumbs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
&::before {
color: $gray-color-light;
content: "/";
padding-right: $unit-2;
@if $rtl == true {
padding-left: $unit-2;
} @else {
padding-right: $unit-2;
}
}
}
}
Expand Down
42 changes: 34 additions & 8 deletions src/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,19 @@
color: currentColor;
height: $unit-4;
line-height: $unit-4;
margin-left: $unit-1;
margin-right: -2px;
opacity: 1;
padding: 0;
text-decoration: none;
width: $unit-4;

@if $rtl == true {
margin-right: $unit-1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered margin-left, margin-right

margin-left: -2px;
} @else {
margin-left: $unit-1;
margin-right: -2px;
}

&:hover {
opacity: .95;
}
Expand All @@ -161,17 +167,37 @@
.btn {
flex: 1 0 auto;
&:first-child:not(:last-child) {
border-bottom-right-radius: 0;
border-top-right-radius: 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

@if $rtl == true {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
} @else {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}

}
&:not(:first-child):not(:last-child) {
border-radius: 0;
margin-left: -$border-width;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

@if $rtl == true {
margin-right: -$border-width;
} @else {
margin-left: -$border-width;
}
}
&:last-child:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
margin-left: -$border-width;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

@if $rtl == true {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
margin-right: -$border-width;
} @else {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
margin-left: -$border-width;
}

}
&:focus,
&:hover,
Expand Down
32 changes: 25 additions & 7 deletions src/_calendars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,21 @@
transform: translateY(-50%);
}
&.range-start {
&::before {
left: 50%;
&::before {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace

@if $rtl == true {
right: 50%;
} @else {
left: 50%;
}
}
}
&.range-end {
&::before {
right: 50%;
@if $rtl == true {
left: 50%;
} @else {
right: 50%;
}
}
}

Expand Down Expand Up @@ -189,14 +197,24 @@
top: 19px;
}
&.range-start {
&::before {
left: auto;
&::before {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace
Nesting should be no greater than 4, but was 5

width: 19px;

@if $rtl == true {
right: auto;
} @else {
left: auto;
}

}
}
&.range-end {
&::before {
right: 19px;
&::before {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line contains trailing whitespace
Nesting should be no greater than 4, but was 5

@if $rtl == true {
left: 19px;
} @else {
right: 19px;
}
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/_chips.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
}

.avatar {
margin-left: -$unit-2;
margin-right: $unit-1;
@if $rtl == true {
margin-right: -$unit-2;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered margin-left, margin-right

margin-left: $unit-1;
} @else {
margin-left: -$unit-2;
margin-right: $unit-1;
}
}

.btn-clear {
Expand Down
4 changes: 4 additions & 0 deletions src/_codes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ code {
color: $body-font-color;
position: relative;

@if $rtl == true {
direction: ltr;
}

&::before {
color: $gray-color;
content: attr(data-lang);
Expand Down
4 changes: 4 additions & 0 deletions src/_comparison-sliders.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
width: 100%;
-webkit-overflow-scrolling: touch;

@if $rtl == true {
direction: ltr;
}

.comparison-before,
.comparison-after {
height: 100%;
Expand Down
76 changes: 62 additions & 14 deletions src/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,21 @@ textarea.form-input {
&[size],
&[multiple] {
height: auto;

option {
padding: $unit-h $unit-1;
}
}
&:not([multiple]):not([size]) {
background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%204%205'%3E%3Cpath%20fill='%23667189'%20d='M2%200L0%202h4zm0%205L0%203h4z'/%3E%3C/svg%3E") no-repeat right .35rem center/.4rem .5rem;
padding-right: $control-icon-size + $control-padding-x;

@if $rtl == true {
background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%204%205'%3E%3Cpath%20fill='%23667189'%20d='M2%200L0%202h4zm0%205L0%203h4z'/%3E%3C/svg%3E") no-repeat left .35rem center/.4rem .5rem;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color literals like #fff should only be used in variable declarations; they should be referred to via variable everywhere else.
center/.4rem should be written with a single space on each side of the operator: center / .4rem

padding-left: $control-icon-size + $control-padding-x;
} @else {
background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%204%205'%3E%3Cpath%20fill='%23667189'%20d='M2%200L0%202h4zm0%205L0%203h4z'/%3E%3C/svg%3E") no-repeat right .35rem center/.4rem .5rem;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color literals like #fff should only be used in variable declarations; they should be referred to via variable everywhere else.
center/.4rem should be written with a single space on each side of the operator: center / .4rem

padding-right: $control-icon-size + $control-padding-x;
}

}
&:focus {
@include control-shadow();
Expand Down Expand Up @@ -197,9 +204,14 @@ textarea.form-input {
line-height: $line-height;
margin: ($control-size - $control-size-sm) / 2 0;
min-height: 1.2rem;
padding: (($control-size-sm - $line-height) / 2) $control-padding-x (($control-size-sm - $line-height) / 2) ($control-icon-size + $control-padding-x);
position: relative;

@if $rtl == true {
padding: (($control-size-sm - $line-height) / 2) ($control-icon-size + $control-padding-x) (($control-size-sm - $line-height) / 2) $control-padding-x;
} @else {
padding: (($control-size-sm - $line-height) / 2) $control-padding-x (($control-size-sm - $line-height) / 2) ($control-icon-size + $control-padding-x);
}

input {
clip: rect(0, 0, 0, 0);
height: 1px;
Expand Down Expand Up @@ -242,9 +254,14 @@ textarea.form-input {
.form-icon {
background: $bg-color-light;
height: $control-icon-size;
left: 0;
top: ($control-size-sm - $control-icon-size) / 2;
width: $control-icon-size;

@if $rtl == true {
right: 0;
} @else {
left: 0;
}
}

input {
Expand Down Expand Up @@ -317,14 +334,17 @@ textarea.form-input {

// Form element: Switch
.form-switch {
padding-left: ($unit-8 + $control-padding-x);
@if $rtl == true {
padding-right: ($unit-8 + $control-padding-x);
} @else {
padding-left: ($unit-8 + $control-padding-x);
}

.form-icon {
background: $gray-color-light;
background-clip: padding-box;
border-radius: $unit-2 + $border-width;
height: $unit-4 + $border-width * 2;
left: 0;
top: ($control-size-sm - $unit-4) / 2 - $border-width;
width: $unit-8;
&::before {
Expand All @@ -339,6 +359,13 @@ textarea.form-input {
top: 0;
width: $unit-4;
}

@if $rtl == true {
right: 0;
} @else {
left: 0;
}

}

input {
Expand Down Expand Up @@ -393,17 +420,38 @@ textarea.form-input {
.input-group-addon,
.input-group-btn {
&:first-child:not(:last-child) {
border-bottom-right-radius: 0;
border-top-right-radius: 0;

@if $rtl == true {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
} @else {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}

}
&:not(:first-child):not(:last-child) {
border-radius: 0;
margin-left: -$border-width;

@if $rtl == true {
margin-right: -$border-width;
} @else {
margin-left: -$border-width;
}

}
&:last-child:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
margin-left: -$border-width;

@if $rtl == true {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
margin-right: -$border-width;
} @else {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
margin-left: -$border-width;
}

}
&:focus {
z-index: $zindex-0 + 1;
Expand Down Expand Up @@ -447,7 +495,7 @@ textarea.form-input {
.form-icon {
border-color: $error-color;
}

input {
&:checked + .form-icon {
background: $error-color;
Expand Down
7 changes: 6 additions & 1 deletion src/_menus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@
}

.menu-badge {
float: right;
padding: $unit-1 0;

@if $rtl == true {
float: left;
} @else {
float: right;
}

.btn {
margin-top: -$unit-h;
}
Expand Down
Loading