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

Add hover and focus effects #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
46 changes: 45 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
width: fit-content;
height: fit-content;
position: relative;
transition: all 0.1s;
box-shadow: rgba(0, 0, 0, 0) 0px 1px 1px 1px;
}

.ingredient-div:hover {
box-shadow: rgba(0, 0, 0, 0.26) 0px 1px 1px 1px;
}

.ingredient-div:active {
box-shadow: rgba(0, 0, 0, 0.39) 0px 1px 1px 1px;
}

.clear-ingredients {
Expand Down Expand Up @@ -205,6 +215,8 @@
.bubble-row {
display: flex;
flex-wrap: wrap;
padding-left: 16px;
padding-right: 16px;
}

.numbering {
Expand All @@ -226,14 +238,46 @@
.bubble {
display: flex;
user-select: none;
border-radius: 25px;
border-radius: 8px;
padding: 4px;
width: fit-content;
height: fit-content;
font-family: monospace;
font-size: 14px;
margin: 2px;
cursor: pointer;
transition: all 0.1s;
}

.search-panel .bubble {
display: block;
background-color: #80808030;
}

.bubble > .sandwich-no {
float: left;
}

.bubble > .sandwich-name {
display: inline-block;
margin-top: 4px;
}

.bubble.highlighted {
background-color: yellow;
}

.bubble.weird {
font-weight: bold;
}

.search-panel .bubble:hover {
background-color: #aaa !important;
}

.search-panel .bubble:active {
background-color: #777 !important;
color: white;
}

.bubble-min-width {
Expand Down
11 changes: 6 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function App() {
const showResults = activeFillings.length > 0 && activeCondiments.length > 0;

return (
<div>
<div class="results">
<div style={{ display: "flex", flexWrap: "wrap", justifyContent: "center" }}>
{ingredients.map((x, i) => <Card ingredient={x} number={i} fillings={activeFillings}
simpleMode={simpleMode}
Expand Down Expand Up @@ -393,14 +393,15 @@ function App() {
const hasMultiIngredients = foodCombo.length !== Array.from(new Set(foodCombo)).length;

return (
<div className="bubble" key={key} id={`sandwich-${sandwich.number}`} onClick={() => {
<div className={`bubble ${highlight ? 'highlighted' : ''} ${isWeird ? 'weird' : ''}`}
key={key} id={`sandwich-${sandwich.number}`} onClick={() => {
const condiments = getCondiments(sandwich.condiments);
const fillings = getFillings(sandwich.fillings);
setActiveCondiments(condiments);
setActiveFillings(fillings);
}} style={{ backgroundColor: highlight ? "yellow" : "#80808030",
fontWeight: isWeird ? "bold" : "", color: hasMultiIngredients ? "" : ""}}>
{`#${sandwich.number} - ${ts(sandwich.name)}`}
}} style={{ color: hasMultiIngredients ? "" : ""}}>
<small class="sandwich-no">#{sandwich.number}</small>
<span class="sandwich-name">{`${sandwich.name}`}</span>
Fleker marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
};
Expand Down