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

styles update #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
45 changes: 43 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}

.power-decrease {
background-color: rgba(255, 95, 95, 0.8) ;
background-color: rgba(255, 95, 95, 0.8);
}

.filling-bkg {
Expand Down Expand Up @@ -146,7 +146,7 @@
margin-top: 10px;
}

.complex-search-panel > * {
.complex-search-panel>* {
Copy link
Author

Choose a reason for hiding this comment

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

Excuse those first "changes". Those were made automatically by my "prettier" plugin. Didn't see them 🤦‍♂️

margin-bottom: 4px;
}

Expand Down Expand Up @@ -178,6 +178,21 @@
position: relative;
}

.card .sandwich-image {
width: 100px;
object-fit: cover;
}

@media (max-width: 600px) {
.card .sandwich-image {
width: 120px;
}
}

.card .sandwich-info {
padding: 7px;
}

#players-icon {
position: absolute;
top: 2px;
Expand Down Expand Up @@ -252,6 +267,7 @@
border-top-right-radius: 0px;
margin-right: 0px;
}

.chain-b {
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
Expand All @@ -260,6 +276,7 @@
margin-right: 0px;
margin-left: 0px;
}

.chain-c {
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
Expand Down Expand Up @@ -293,6 +310,7 @@
from {
transform: rotate(0deg);
}

to {
transform: rotate(360deg);
}
Expand Down Expand Up @@ -321,3 +339,26 @@ small {
text-decoration: underline;
}

.ingredients-results {
padding: 20px 0px;
display: flex;
flex-direction: column;
row-gap: 10px;
}

.advanced-mode .card {
max-width: 90%;
padding: 7px;
}

@media (max-width: 600px) {
.advanced-mode .card {
max-width: 70%;
}
}

.flex-wrap {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
56 changes: 37 additions & 19 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FLAVORS from './data/flavors.json';
import { useEffect, useState } from 'react';
import { getCondiments, getFillings, getRecipeFromIngredients, ts, LANGUAGE_NAMES, getNumberOfPlayers,
ALIAS_TO_FULL, FULL_TO_ALIAS, COLORS, oneTwoFirst, getIngredientsSums, craftSandwich, checkPresetSandwich,
copyTextToClipboard, hasRelevance, getCategory, getIngredientsFromRecipe } from './util';
copyTextToClipboard, hasRelevance, getCategory, getIngredientsFromRecipe, isFilling } from './util';
import { runTests } from './test/tests';
import Card from './components/Card';
import './App.css';
Expand Down Expand Up @@ -306,12 +306,11 @@ function App() {

return (
<div className='card' style={{ display: "flex" }}>
<img alt={ts(sandwich.name)}
<img className='sandwich-image' alt={ts(sandwich.name)}
src={sandwich.imageUrl}
style={{ width: "100px" }}
/>
{megaSandwichMode && <div id="players-icon">{numberOfPlayers}P</div>}
<div>
<div className='sandwich-info'>
<div className="bubble bubble-header" onClick={() => {
if(window.event.ctrlKey) { runTests(); }
}}
Expand Down Expand Up @@ -355,28 +354,47 @@ function App() {
// with only condiments.
const showResults = activeFillings.length > 0 && activeCondiments.length > 0;

const fillings = []
const flavours = []
ingredients.forEach((item) => isFilling(item) ? fillings.push(item) : flavours.push(item))

const renderCard = (isFlavour) => (x, i) => (<Card
ingredient={x}
number={isFlavour ? fillings.length + i : i}
fillings={activeFillings}
simpleMode={simpleMode}
key={i}
updatePieces={() => pulse()}
onClickBubble={key => toggleActiveKey(key)}
activeKey={activeKey}
onClick={() => {
if (!simpleMode) {
setAdvancedIngredients(!advancedIngredients);
}
}}
condiments={activeCondiments} detail={!simpleMode && advancedIngredients} />
)

return (
<div>
<div style={{ display: "flex", flexWrap: "wrap", justifyContent: "center" }}>
{ingredients.map((x, i) => <Card ingredient={x} number={i} fillings={activeFillings}
simpleMode={simpleMode}
updatePieces={() => pulse()}
onClickBubble={key => toggleActiveKey(key)}
activeKey={activeKey}
onClick={() => {
if (!simpleMode) {
setAdvancedIngredients(!advancedIngredients);
}
}}
condiments={activeCondiments} detail={!simpleMode && advancedIngredients} />)}
{!advancedIngredients && <br className='page-break' />}
<div className='ingredients-results'>
<div className='flex-wrap fillings'>
{fillings.map(renderCard(false))}
</div>
<div className='flex-wrap flavours'>
{flavours.map(renderCard(true))}
</div>
{showResults && !simpleMode
&& <Card sums={sums} activeSandwich={activeSandwich}
&&
<div className='flex-wrap advanced-mode'>
<Card sums={sums} activeSandwich={activeSandwich}
fillings={activeFillings} condiments={activeCondiments}
detail={!simpleMode && advancedIngredients}
onClickBubble={key => toggleActiveKey(key)}
activeKey={activeKey}
/>}
/>
</div>
}
</div>
<div className="bubble-row" style={{ justifyContent: "center" }}>
{renderSandwich(foundSandwich)}
Expand Down