Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.

Implemented directory handling using a cursor #21

Merged
merged 5 commits into from
Aug 16, 2018

Conversation

irokas
Copy link
Contributor

@irokas irokas commented Aug 8, 2018

No description provided.

demo/index.html Outdated
@@ -5,6 +5,7 @@
<title>Document</title>
<script src="../dist/fsapi.js"></script>
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
Copy link
Member

Choose a reason for hiding this comment

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

Remove fontawesome please, as we do not need it 😄

src/main.js Outdated
const liElement = document.createElement("li");
liElement.classList.add("fs-api-entry", `fs-api-${item.type}`);
if (item.type === "directory") {
handler.textContent = "›";
handler.classList.add("handler");
Copy link
Member

Choose a reason for hiding this comment

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

The classname handler is too generic. We should prefer something like fs-api-directory-handler.

src/main.js Outdated
if (item.type === "directory") {
handler.textContent = "›";
handler.classList.add("handler");
handler.classList.add("rotatedHandler");
Copy link
Member

Choose a reason for hiding this comment

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

This is redundant. We can use pure CSS rules to achieve this. Example

.fs-api-directory-collapse > .fs-api-directory-handler {
  /* rotate stuff */
}

demo/main.css Outdated
cursor: pointer;
}

.rotatedHandler {
Copy link
Member

Choose a reason for hiding this comment

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

This is redundant. We can use pure CSS rules to achieve this. Example

.fs-api-directory-collapse > .fs-api-directory-handler {
  /* rotate stuff */
}

demo/main.css Outdated
.fs-api-directory > .fs-api-directory-handler {
display: inline-block;
transform: rotate(90deg);
-ms-transform: rotate(90deg);
Copy link
Member

Choose a reason for hiding this comment

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

Remove -ms-transform. We can use it without the -ms- vendor prefix these days: https://caniuse.com/#feat=transforms2d.

demo/main.css Outdated
.fs-api-directory-collapse > .fs-api-directory-handler {
display: inline-block;
transform: rotate(0deg);
-ms-transform: rotate(0deg);
Copy link
Member

Choose a reason for hiding this comment

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

Remove -ms-transform. We can use it without the -ms- vendor prefix these days: https://caniuse.com/#feat=transforms2d.

demo/main.css Outdated
display: inline-block;
transform: rotate(90deg);
-ms-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
Copy link
Member

Choose a reason for hiding this comment

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

Remove -webkit-transform. We can use it without the -webkit- vendor prefix these days: https://caniuse.com/#feat=transforms2d.

demo/main.css Outdated
display: inline-block;
transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
Copy link
Member

Choose a reason for hiding this comment

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

Remove -webkit-transform. We can use it without the -webkit- vendor prefix these days: https://caniuse.com/#feat=transforms2d.

src/main.js Outdated
const liElement = document.createElement("li");
liElement.classList.add("fs-api-entry", `fs-api-${item.type}`);
if (item.type === "directory") {
handler.textContent = "›";
handler.classList.add("rotatedHandler");
Copy link
Member

Choose a reason for hiding this comment

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

We do not need rotatedHandler any more.

src/main.js Outdated

/**Takes the clicked element and toggles the directory.
* @param {HTMLSpanElement} nameElement - The clicked element.
*/
function toggleDirectory(nameElement) {
if (nameElement.parentNode.classList.contains("fs-api-directory-collapse")) {
nameElement.parentNode.classList.remove("fs-api-directory-collapse");
nameElement.previousSibling.classList.add("rotatedHandler");
Copy link
Member

Choose a reason for hiding this comment

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

We do not need rotatedHandler any more.

src/main.js Outdated
} else {
nameElement.parentNode.classList.add("fs-api-directory-collapse");
nameElement.previousSibling.classList.remove("rotatedHandler");
Copy link
Member

Choose a reason for hiding this comment

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

We do not need rotatedHandler any more.

@irokas irokas force-pushed the Implement-directory-handle branch from aacdd6a to 77594da Compare August 16, 2018 16:25
Copy link
Member

@parisk parisk left a comment

Choose a reason for hiding this comment

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

LGTM 🍰

@parisk parisk merged commit 7af3fde into sourcelair:master Aug 16, 2018
@parisk parisk added this to the 0.3 milestone Aug 16, 2018
@irokas irokas deleted the Implement-directory-handle branch August 20, 2018 08:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants