Commit 34f28a6d authored by Miguel Rincon's avatar Miguel Rincon

Merge branch...

Merge branch '27767-fix-the-following-style-lint-errors-and-warnings-for-app-assets-stylesheets-framework-toggle' into 'master'

Fix style-lint warnings for `app/assets/stylesheets/framework/toggle.scss`

See merge request gitlab-org/gitlab!38537
parents 2789f209 e2bb283d
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlIcon } from '@gitlab/ui';
import { s__ } from '../../locale'; import { s__ } from '../../locale';
import icon from './icon.vue';
const ICON_ON = 'status_success_borderless'; const ICON_ON = 'status_success_borderless';
const ICON_OFF = 'status_failed_borderless'; const ICON_OFF = 'status_failed_borderless';
...@@ -10,7 +9,7 @@ const LABEL_OFF = s__('ToggleButton|Toggle Status: OFF'); ...@@ -10,7 +9,7 @@ const LABEL_OFF = s__('ToggleButton|Toggle Status: OFF');
export default { export default {
components: { components: {
icon, GlIcon,
GlLoadingIcon, GlLoadingIcon,
}, },
...@@ -63,18 +62,27 @@ export default { ...@@ -63,18 +62,27 @@ export default {
<label class="toggle-wrapper"> <label class="toggle-wrapper">
<input v-if="name" :name="name" :value="value" type="hidden" /> <input v-if="name" :name="name" :value="value" type="hidden" />
<button <button
type="button"
role="switch"
class="project-feature-toggle"
:aria-label="ariaLabel" :aria-label="ariaLabel"
:aria-checked="value"
:class="{ :class="{
'is-checked': value, 'is-checked': value,
'gl-blue-500': value,
'is-disabled': disabledInput, 'is-disabled': disabledInput,
'is-loading': isLoading, 'is-loading': isLoading,
}" }"
type="button"
class="project-feature-toggle"
@click="toggleFeature" @click="toggleFeature"
> >
<gl-loading-icon class="loading-icon" /> <gl-loading-icon class="loading-icon" />
<span class="toggle-icon"> <icon :name="toggleIcon" class="toggle-icon-svg" /> </span> <span class="toggle-icon">
<gl-icon
:size="18"
:name="toggleIcon"
:class="value ? 'gl-text-blue-500' : 'gl-text-gray-400'"
/>
</span>
</button> </button>
</label> </label>
</template> </template>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
height: 24px; height: 24px;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
background: $gl-gray-400; background: $gray-400;
border-radius: 12px; border-radius: 12px;
padding: 3px; padding: 3px;
transition: all 0.4s ease; transition: all 0.4s ease;
...@@ -51,28 +51,12 @@ ...@@ -51,28 +51,12 @@
display: block; display: block;
left: 0; left: 0;
border-radius: 9px; border-radius: 9px;
background: $feature-toggle-color; background: $white;
transition: all 0.2s ease; transition: all 0.2s ease;
&,
.toggle-icon-svg {
width: $default-icon-size; width: $default-icon-size;
height: $default-icon-size; height: $default-icon-size;
} }
.toggle-icon-svg {
fill: $gl-gray-400;
}
.toggle-status-checked {
display: none;
}
.toggle-status-unchecked {
display: inline;
}
}
.loading-icon { .loading-icon {
display: none; display: none;
font-size: 12px; font-size: 12px;
...@@ -84,10 +68,6 @@ ...@@ -84,10 +68,6 @@
} }
&.is-loading { &.is-loading {
.toggle-icon {
display: none;
}
.loading-icon { .loading-icon {
display: block; display: block;
...@@ -101,24 +81,23 @@ ...@@ -101,24 +81,23 @@
} }
&.is-checked { &.is-checked {
background: $feature-toggle-color-enabled; background: $blue-400;
.toggle-icon { .toggle-icon {
left: calc(100% - 18px); left: calc(100% - 18px);
}
.toggle-icon-svg {
fill: $feature-toggle-color-enabled;
} }
.toggle-status-checked { &.is-checked .toggle-icon .toggle-status-checked,
.toggle-icon .toggle-status-unchecked {
display: inline; display: inline;
} }
.toggle-status-unchecked { &.is-checked .toggle-icon .toggle-status-unchecked,
&.is-loading .toggle-icon,
.toggle-icon .toggle-status-checked {
display: none; display: none;
} }
}
}
&.is-disabled { &.is-disabled {
opacity: 0.4; opacity: 0.4;
......
...@@ -751,10 +751,6 @@ $login-brand-holder-color: #888; ...@@ -751,10 +751,6 @@ $login-brand-holder-color: #888;
$project-option-descr-color: #54565b; $project-option-descr-color: #54565b;
$project-network-controls-color: #888; $project-network-controls-color: #888;
$feature-toggle-color: #fff;
$feature-toggle-text-color: #fff;
$feature-toggle-color-enabled: #4a8bee;
/* /*
* Monitor Charts * Monitor Charts
*/ */
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
"aria-label": _("Automatic certificate management using Let's Encrypt") } "aria-label": _("Automatic certificate management using Let's Encrypt") }
= f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input" = f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input"
%span.toggle-icon %span.toggle-icon
= sprite_icon("status_success_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-checked") = sprite_icon("status_success_borderless", size: 18, css_class: "gl-text-blue-500 toggle-status-checked")
= sprite_icon("status_failed_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-unchecked") = sprite_icon("status_failed_borderless", size: 18, css_class: "gl-text-gray-400 toggle-status-unchecked")
%p.text-secondary.mt-3 %p.text-secondary.mt-3
- docs_link_url = help_page_path("user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md") - docs_link_url = help_page_path("user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md")
- docs_link_start = "<a href=\"%{docs_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { docs_link_url: docs_link_url } - docs_link_start = "<a href=\"%{docs_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { docs_link_url: docs_link_url }
......
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
- if yield.present? - if yield.present?
= yield = yield
%span.toggle-icon %span.toggle-icon
= sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked') = sprite_icon('status_success_borderless', size: 18, css_class: 'gl-text-blue-500 toggle-status-checked')
= sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked') = sprite_icon('status_failed_borderless', size: 18, css_class: 'gl-text-gray-400 toggle-status-unchecked')
---
title: Update color and vertical alignment of project feature toggle
merge_request: 38537
author:
type: changed
...@@ -32,7 +32,7 @@ describe('Toggle Button', () => { ...@@ -32,7 +32,7 @@ describe('Toggle Button', () => {
it('renders input status icon', () => { it('renders input status icon', () => {
expect(vm.$el.querySelectorAll('span.toggle-icon').length).toEqual(1); expect(vm.$el.querySelectorAll('span.toggle-icon').length).toEqual(1);
expect(vm.$el.querySelectorAll('svg.s16.toggle-icon-svg').length).toEqual(1); expect(vm.$el.querySelectorAll('svg.s18').length).toEqual(1);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment