Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Tami/boolean operators #10

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Tami/boolean operators #10

wants to merge 12 commits into from

Conversation

tamirissg
Copy link

No description provided.

Comment on lines 11 to 17
.chip
{
border: 1px solid transparent;
}
.chip:hover {
border: 1px solid black;
}
Copy link
Member

Choose a reason for hiding this comment

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

You can't override mystique classes here, this will apply to all chips in the page, replacing the style everywhere.

Create a class for this purpose, like autocomplete-chip.

auto-complete.js Outdated
Comment on lines 66 to 69
window.changeText = () => {

const newText =
`
Copy link
Member

Choose a reason for hiding this comment

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

Do not use ES2015+ syntax features, like arrow function, const or template string. Doing this will break the whole JS script for older browsers, all code from the Topbar JS will not work.

Use ES5 syntax.

auto-complete.js Outdated
@@ -62,6 +62,44 @@
});
}


window.changeText = () => {
Copy link
Member

Choose a reason for hiding this comment

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

Avoid using global object window for this, it's considered bad practice because of the unscoped access, you could easily replace this function in another place and will break this code.

Instead, create a local function

function changeText() { ... }

And add it using JS

var buttons = document.getElementsByClassName('autocomplete-boolean-button');
for (var i = 0; i < buttons.length; i++) {
  var button = buttons[i];
  button.addEventListener('click', changeText);
}

auto-complete.js Outdated

const newText =
`
<div style="margin: 0.4em" class="row">
Copy link
Member

Choose a reason for hiding this comment

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

margin: 0.4em? This does not seem to be correct, check with Predo.

auto-complete.js Outdated
const newText =
`
<div style="margin: 0.4em" class="row">
<span style="font-size: 10px" type="button" class="chip chip--outline chip--sm" data-toggle="tooltip" data-placement="bottom-right"
Copy link
Member

Choose a reason for hiding this comment

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

type="button" is not a valid attribute here, also, it does not behave as a button.

Suggested change
<span style="font-size: 10px" type="button" class="chip chip--outline chip--sm" data-toggle="tooltip" data-placement="bottom-right"
<span style="font-size: 10px" class="chip chip--outline chip--sm" data-toggle="tooltip" data-placement="bottom-right"

Change in every other span.

auto-complete.js Outdated
}
var footerBooleanOperators = `
<hr style="margin: 0.4em">
<div id= "search" style="margin-left: 0.6em" >
Copy link
Member

Choose a reason for hiding this comment

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

Do not use id, this script will be executed more than once in SERP home for example and the id will conflict.

Suggested change
<div id= "search" style="margin-left: 0.6em" >
<div style="margin-left: 0.6em">

Copy link
Member

Choose a reason for hiding this comment

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

Also, all sizes using em unit seems to be wrong, ask Predo about this.

auto-complete.js Outdated
</span>
</div> `

document.getElementById('search').innerHTML = newText;
Copy link
Member

Choose a reason for hiding this comment

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

Avoid using id, this won't work if there is 2 or more elements in the same page with same id. Also, search is too common name to be used for id and likely to conflict.

Suggested change
document.getElementById('search').innerHTML = newText;
this.parentElement.innerHTML = newText;

auto-complete.js Outdated
var footerBooleanOperators = `
<hr style="margin: 0.4em">
<div id= "search" style="margin-left: 0.6em" >
<button class="btn btn--flat btn--blue" style="font-size: 10px" onclick= "changeText()" >
Copy link
Member

Choose a reason for hiding this comment

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

Like I said above

Suggested change
<button class="btn btn--flat btn--blue" style="font-size: 10px" onclick= "changeText()" >
<button class="btn btn--flat btn--blue autocomplete-boolean-button" style="font-size: 10px">

auto-complete.js Outdated
Comment on lines 98 to 100
DICAS PARA ESPECIFICAR SUA BUSCA
</button>
</div>`
Copy link
Member

Choose a reason for hiding this comment

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

We use 2 spaces for indentation level

Suggested change
DICAS PARA ESPECIFICAR SUA BUSCA
</button>
</div>`
DICAS PARA ESPECIFICAR SUA BUSCA
</button>
</div>`

auto-complete.js Outdated
document.getElementById('search').innerHTML = newText;

}
var footerBooleanOperators = `
Copy link
Member

Choose a reason for hiding this comment

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

Do not use template string, for the same reason I said above.

Copy link
Member

@felipemsantana felipemsantana left a comment

Choose a reason for hiding this comment

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

Delete package-lock.json file

Comment on lines +34 to +36
.row{
margin-inline-start: 5px;
}
Copy link
Member

Choose a reason for hiding this comment

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

Remove this, it's a mystique class

font-size: 10px;
line-height: 16px;
margin-inline-start: 10px;
align-items: center;
Copy link
Member

Choose a reason for hiding this comment

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

This does not work without flex, remove

border-color:black;
}

.autocomplete-chip::before {
Copy link
Member

Choose a reason for hiding this comment

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

This element does not have any text, also it should keep the mystique default style, remove

}

.autocomplete-chip:hover {
border-color:black;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
border-color:black;
border-color: black;

var top = pos.top + 1;
var clonedNode = this.cloneNode(true);
clonedNode.style =
'color:transparent;box-shadow:none;z-index:10000;position:absolute;left:' + left + 'px;top:' + top + 'px';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'color:transparent;box-shadow:none;z-index:10000;position:absolute;left:' + left + 'px;top:' + top + 'px';
'color:transparent;box-shadow:none;z-index:10000;position:absolute;left:' + left + 'px;top:' + top + 'px';

'color:transparent;box-shadow:none;z-index:10000;position:absolute;left:' + left + 'px;top:' + top + 'px';

addEvent(clonedNode, 'mouseout', function () {

Copy link
Member

Choose a reason for hiding this comment

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

Where is the remove child function?

})

function renderText(tooltip, text) {
Copy link
Member

Choose a reason for hiding this comment

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

What is this?

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