-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2595 from AlchemyCMS/shoelaces
Use Shoelace Tab for tabs
- Loading branch information
Showing
25 changed files
with
165 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,45 @@ | ||
window.Alchemy = Alchemy || {}; | ||
window.Alchemy = Alchemy || {} | ||
|
||
Alchemy.FixedElements = { | ||
WRAPPER: '<div id="fixed-elements"></div>', | ||
TABS: '<ul><li><a href="#main-content-elements">{{label}}</a></li></ul>', | ||
WRAPPER: '<sl-tab-group id="fixed-elements" />', | ||
TABS: '<sl-tab slot="nav" panel="main-content-elements">{{label}}</sl-tab>', | ||
|
||
// Builds fixed elements tabs | ||
buildTabs: function(label) { | ||
buildTabs: function (label) { | ||
var $wrapper = $(this.WRAPPER), | ||
$tabs = $(this.TABS.replace(/{{label}}/, label)); | ||
$tabs = $(this.TABS.replace(/{{label}}/, label)) | ||
|
||
$('#main-content-elements').wrap($wrapper); | ||
$('#fixed-elements').prepend($tabs).tabs().tabs('paging', { | ||
follow: true, | ||
followOnSelect: true | ||
}); | ||
$("#main-content-elements").wrap($wrapper) | ||
$("#fixed-elements").prepend($tabs) | ||
}, | ||
|
||
// Creates a fixed element tab. | ||
createTab: function(element_id, label) { | ||
var $fixed_elements = $('#fixed-elements'), | ||
$tab; | ||
|
||
$('> ul', $fixed_elements).append('<li><a href="#fixed-element-' + element_id + '">' + label + '</a></li>'); | ||
$tab = $('<div id="fixed-element-' + element_id + '" class="sortable-elements" />'); | ||
$fixed_elements.append($tab); | ||
$fixed_elements.tabs().tabs('refresh'); | ||
$fixed_elements.tabs('option', 'active', $('#fixed-elements > div').index($tab)); | ||
createTab: function (element_id, label) { | ||
var $fixed_elements = $("#fixed-elements") | ||
var panel_name = "fixed-element-" + element_id | ||
|
||
var $tab = | ||
'<sl-tab slot="nav" panel="' + panel_name + '">' + label + "</sl-tab>" | ||
$fixed_elements.append($tab) | ||
|
||
var $panel = $( | ||
'<sl-tab-panel name="' + panel_name + '" class="sortable-elements" />' | ||
) | ||
$fixed_elements.append($panel) | ||
window.requestAnimationFrame(function () { | ||
$fixed_elements.get(0).show(panel_name) | ||
}) | ||
}, | ||
|
||
removeTab: function(element_id) { | ||
var $fixed_elements = $('#fixed-elements'); | ||
removeTab: function (element_id) { | ||
var $fixed_elements = $("#fixed-elements") | ||
|
||
$fixed_elements.find('a[href="#fixed-element-' + element_id + '"]').parent().remove(); | ||
$fixed_elements.find('div#fixed-element-' + element_id).remove(); | ||
$fixed_elements.tabs().tabs('refresh'); | ||
$fixed_elements | ||
.find('sl-tab[panel="fixed-element-' + element_id + '"]') | ||
.remove() | ||
$fixed_elements | ||
.find('sl-tab-panel[name="fixed-element-' + element_id + '"]') | ||
.remove() | ||
$fixed_elements.get(0).show("main-content-elements") | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
:root, | ||
:host, | ||
.sl-theme-light { | ||
--sl-font-size-small: #{$base-font-size}; | ||
--sl-color-primary-600: #{$dark-blue}; | ||
--sl-color-neutral-600: #{$text-color}; | ||
--sl-focus-ring-color: #{$focus-color}; | ||
--sl-focus-ring-width: 2px; | ||
} | ||
|
||
sl-tab-group { | ||
--indicator-color: #{$dark-orange}; | ||
--track-color: #{$medium-gray}; | ||
|
||
&::part(base) { | ||
background-color: #{$light-gray}; | ||
} | ||
} | ||
|
||
sl-tab-panel { | ||
--padding: #{4 * $default-padding}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.