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

Cleanup styles. #1131

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 0 additions & 2 deletions _sass/_patterns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@
@import "src/pat/notification/notification";
@import "src/pat/sortable/sortable";
@import "src/pat/stacks/stacks";
@import "src/pat/switch/switch";
@import "src/pat/syntax-highlight/syntax-highlight";
@import "src/pat/toggle/toggle";
@import "src/pat/tooltip/tooltip";
4 changes: 2 additions & 2 deletions src/pat/collapsible/_collapsible.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "settings";
@import "components/button";
@import "../../../_sass/settings";
@import "../../../_sass/components/button";

.pat-collapsible {
margin-bottom: 0.5em;
Expand Down
4 changes: 4 additions & 0 deletions src/pat/collapsible/collapsible.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class Pattern extends BasePattern {
};

init() {
if (window.__patternslib_import_styles) {
import("./_collapsible.scss");
}

const $el = (this.$el = $(this.el));

let $content;
Expand Down
2 changes: 1 addition & 1 deletion src/pat/gallery/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const parser = new Parser("gallery");
parser.addArgument("item-selector", "a"); // selector for anchor element, which is added to the gallery.
parser.addArgument("loop", true);
parser.addArgument("scale-method", "fit", ["fit", "fitNoUpscale", "zoom"]);
parser.addArgument("delay", 30000);
parser.addArgument("delay", 1);
parser.addArgument("effect-duration", 250);

let PhotoSwipe;
Expand Down
13 changes: 9 additions & 4 deletions src/pat/sortable/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Parser from "../../core/parser";

export const parser = new Parser("sortable");
parser.addArgument("selector", "li");
parser.addArgument("handle-selector", ".sortable-handle");
parser.addArgument("drag-class", "dragged"); // Class to apply to item that is being dragged.
parser.addArgument("drop"); // Callback function for when item is dropped (null)

Expand Down Expand Up @@ -52,21 +53,24 @@ export default Base.extend({

addHandles: function () {
for (const sortable of this.$sortables) {
const handles = dom.querySelectorAllAndMe(sortable, ".sortable-handle");
const handles = dom.querySelectorAllAndMe(
sortable,
this.options.handleSelector
);
if (handles.length === 0) {
// TODO: we should change to a <button>.
const handle = document.createElement("a");
handle.textContent = "⇕";
handle.classList.add("sortable-handle");
handle.setAttribute("draggable", "true");
handle.setAttribute("href", "#");
//handle.setAttribute("title", "Drag to reorder"); // TODO: specify if that should be kept.
handle.setAttribute("aria-label", "Drag to reorder");
sortable.appendChild(handle);
handles.push(handle);
}

for (const handle of handles) {
handle.setAttribute("draggable", "true");
handle.setAttribute("aria-label", "Drag to reorder");
// TODO: remove when element is a button.
events.add_event_listener(
handle,
Expand Down Expand Up @@ -170,7 +174,8 @@ export default Base.extend({
if (ev.dataTransfer) {
// Firefox seems to need this set to any value
ev.dataTransfer.setData("Text", "");
ev.dataTransfer.effectAllowed = ["move"];
ev.dataTransfer.dropEffect = "move";
ev.dataTransfer.effectAllowed = "move";
if ("setDragImage" in ev.dataTransfer) {
ev.dataTransfer.setDragImage($dragged[0], 0, 0);
}
Expand Down
9 changes: 0 additions & 9 deletions src/pat/switch/_switch.scss

This file was deleted.

19 changes: 0 additions & 19 deletions src/pat/toggle/_toggle.scss

This file was deleted.

5 changes: 2 additions & 3 deletions src/pat/toggle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<meta charset="utf-8">
<link rel="stylesheet" href="/style/common.css" />
<script src="/bundle.min.js"></script>
</head>
<body>
<style>
.green {
background-color: #23bf42;
Expand All @@ -23,8 +25,6 @@
color: white;
}
</style>
</head>
<body>
<div class="row">
<article class="pat-rich six columns">
<h2>Toggle a class</h2>
Expand Down Expand Up @@ -70,7 +70,6 @@ <h2>Toggle with checkboxes and pat-checklist</h2>
<input type="checkbox" name="toggler">
change
</label>

</section>
</body>
</html>