Commit a7102fb7 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Annabel Dunstone Gray

Make dropdown style on project page consistent

parent 27d34789
...@@ -10,14 +10,19 @@ import Cookies from 'js-cookie'; ...@@ -10,14 +10,19 @@ import Cookies from 'js-cookie';
const $projectCloneField = $('#project_clone'); const $projectCloneField = $('#project_clone');
const $cloneBtnText = $('a.clone-dropdown-btn span'); const $cloneBtnText = $('a.clone-dropdown-btn span');
const selectedCloneOption = $cloneBtnText.text().trim();
if (selectedCloneOption.length > 0) {
$(`a:contains('${selectedCloneOption}')`, $cloneOptions).addClass('is-active');
}
$('a', $cloneOptions).on('click', (e) => { $('a', $cloneOptions).on('click', (e) => {
const $this = $(e.currentTarget); const $this = $(e.currentTarget);
const url = $this.attr('href'); const url = $this.attr('href');
e.preventDefault(); e.preventDefault();
$('.active', $cloneOptions).not($this).removeClass('active'); $('.is-active', $cloneOptions).not($this).removeClass('is-active');
$this.toggleClass('active'); $this.toggleClass('is-active');
$projectCloneField.val(url); $projectCloneField.val(url);
$cloneBtnText.text($this.text()); $cloneBtnText.text($this.text());
......
...@@ -722,3 +722,48 @@ ...@@ -722,3 +722,48 @@
@include set-invisible; @include set-invisible;
overflow: hidden; overflow: hidden;
} }
// TODO: change global style and remove mixin
@mixin new-style-dropdown {
.dropdown-menu {
li {
padding: 0 1px;
&.dropdown-header {
padding: 8px 16px;
}
a {
border-radius: 0;
padding: 8px 16px;
&.is-focused,
&:hover,
&:active,
&:focus {
background-color: $gray-darker;
}
&.is-active {
font-weight: inherit;
&::before {
top: 16px;
}
}
}
}
&.dropdown-menu-selectable {
li {
a {
padding: 8px 40px;
&.is-active::before {
left: 16px;
}
}
}
}
}
}
...@@ -282,6 +282,8 @@ ...@@ -282,6 +282,8 @@
} }
.project-repo-buttons { .project-repo-buttons {
@include new-style-dropdown;
.project-action-button .dropdown-menu { .project-action-button .dropdown-menu {
max-height: 250px; max-height: 250px;
overflow-y: auto; overflow-y: auto;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
%span %span
= default_clone_protocol.upcase = default_clone_protocol.upcase
= icon('caret-down') = icon('caret-down')
%ul.dropdown-menu.dropdown-menu-right.clone-options-dropdown %ul.dropdown-menu.dropdown-menu-selectable.dropdown-menu-right.clone-options-dropdown
%li %li
= ssh_clone_button(project) = ssh_clone_button(project)
%li %li
......
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