Skip to content
Snippets Groups Projects
Commit cebb17ec authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

Merge branch '467-mui-buttons' into 'dev'

fix: replace standard buttons with mui

See merge request !891
parents 42ffe63a 4659bd45
No related branches found
No related tags found
2 merge requests!905MEP 2.4 : intégration Ma Bulle,!891fix: replace standard buttons with mui
import { Button } from '@material-ui/core'
import defaultChallengeIcon from 'assets/icons/visu/challenge/CHALLENGE0001.svg' import defaultChallengeIcon from 'assets/icons/visu/challenge/CHALLENGE0001.svg'
import circleChecked from 'assets/icons/visu/challenge/circleChecked.svg' import circleChecked from 'assets/icons/visu/challenge/circleChecked.svg'
import circleUnchecked from 'assets/icons/visu/challenge/circleUnchecked.svg' import circleUnchecked from 'assets/icons/visu/challenge/circleUnchecked.svg'
import circleStar from 'assets/icons/visu/duel/circleStar.svg' import circleStar from 'assets/icons/visu/duel/circleStar.svg'
import defaultIcon from 'assets/icons/visu/duel/default.svg' import defaultIcon from 'assets/icons/visu/duel/default.svg'
import lockedDuel from 'assets/icons/visu/duel/locked.svg'
import classNames from 'classnames' import classNames from 'classnames'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import Loader from 'components/Loader/Loader' import Loader from 'components/Loader/Loader'
...@@ -153,7 +155,7 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({ ...@@ -153,7 +155,7 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
}, [client, currentDataload, userChallenge, dispatch]) }, [client, currentDataload, userChallenge, dispatch])
const quizButton = () => ( const quizButton = () => (
<button <Button
title={t('challenge.card.ongoing.quiz')} title={t('challenge.card.ongoing.quiz')}
tabIndex={userChallenge.progress.quizProgress === 5 ? -1 : 0} tabIndex={userChallenge.progress.quizProgress === 5 ? -1 : 0}
className={classNames('smallCard', { className={classNames('smallCard', {
...@@ -174,11 +176,11 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({ ...@@ -174,11 +176,11 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
<span>{t('challenge.card.ongoing.quiz')}</span> <span>{t('challenge.card.ongoing.quiz')}</span>
<StarsContainer result={userChallenge.progress.quizProgress} /> <StarsContainer result={userChallenge.progress.quizProgress} />
</div> </div>
</button> </Button>
) )
const explorationButton = () => ( const explorationButton = () => (
<button <Button
title={t('challenge.card.ongoing.exploration')} title={t('challenge.card.ongoing.exploration')}
tabIndex={userChallenge.progress.explorationProgress === 5 ? -1 : 0} tabIndex={userChallenge.progress.explorationProgress === 5 ? -1 : 0}
className={classNames('smallCard explorationCard', { className={classNames('smallCard explorationCard', {
...@@ -203,11 +205,11 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({ ...@@ -203,11 +205,11 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
<span>{t('challenge.card.ongoing.exploration')}</span> <span>{t('challenge.card.ongoing.exploration')}</span>
<StarsContainer result={userChallenge.progress.explorationProgress} /> <StarsContainer result={userChallenge.progress.explorationProgress} />
</div> </div>
</button> </Button>
) )
const actionButton = () => ( const actionButton = () => (
<button <Button
title={t('challenge.card.ongoing.action')} title={t('challenge.card.ongoing.action')}
tabIndex={userChallenge.progress.actionProgress === 5 ? -1 : 0} tabIndex={userChallenge.progress.actionProgress === 5 ? -1 : 0}
className={classNames('smallCard actionCard', { className={classNames('smallCard actionCard', {
...@@ -231,11 +233,11 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({ ...@@ -231,11 +233,11 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
<span>{t('challenge.card.ongoing.action')}</span> <span>{t('challenge.card.ongoing.action')}</span>
<StarsContainer result={userChallenge.progress.actionProgress} /> <StarsContainer result={userChallenge.progress.actionProgress} />
</div> </div>
</button> </Button>
) )
const duelButton = ( const duelButton = (
<button className="smallCard goDuel" onClick={goDuel}> <Button className="smallCard goDuel" onClick={goDuel}>
{isLoading ? ( {isLoading ? (
<div className="spinner-container"> <div className="spinner-container">
<Loader color="black" /> <Loader color="black" />
...@@ -250,14 +252,14 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({ ...@@ -250,14 +252,14 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
/> />
</> </>
)} )}
</button> </Button>
) )
const duelCard = (content: JSX.Element, extraClassName = '') => ( const duelCard = (content: JSX.Element, extraClassName = '') => (
<div className={`smallCard duelCard ${extraClassName}`} onClick={goDuel}> <Button className={`smallCard duelCard ${extraClassName}`} onClick={goDuel}>
{content} {content}
<StyledIcon className="circleStar" icon={challengeIcon} size={60} /> <StyledIcon className="circleStar" icon={challengeIcon} size={60} />
</div> </Button>
) )
const duelContainer = () => { const duelContainer = () => {
...@@ -290,14 +292,17 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({ ...@@ -290,14 +292,17 @@ const ChallengeCardOnGoing: React.FC<ChallengeCardOnGoingProps> = ({
'active' 'active'
) )
} else { } else {
return duelCard( return (
<p className="starCount"> <Button className={`smallCard duelCard duelLocked`} disabled>
<StyledIcon icon={circleStar} size={30} /> <div className="starCount">
<span className="blueNumber"> <StyledIcon icon={circleStar} size={30} />
{quizProgress + explorationProgress + actionProgress} <span className="blueNumber">
</span> {quizProgress + explorationProgress + actionProgress}
<span>{` / ${target}`}</span> </span>
</p> <span>{` / ${target}`}</span>
</div>
<StyledIcon className="circleStar" icon={lockedDuel} size={60} />
</Button>
) )
} }
} }
......
...@@ -26,144 +26,133 @@ ...@@ -26,144 +26,133 @@
padding: 0 1rem; padding: 0 1rem;
max-width: 235px; max-width: 235px;
} }
.smallCard {
.notifChallenge {
position: absolute;
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
border: none; right: 4px;
width: 100%; top: 4px;
width: 1.25rem;
height: 1.25rem;
color: $dark-light;
border-radius: 50%;
border: 1px solid $dark-light;
z-index: 1;
background: $blue-radial-gradient;
font-size: 12px;
}
.smallCard {
background: $grey-linear-gradient-background; background: $grey-linear-gradient-background;
height: 24%;
max-height: 90px; max-height: 90px;
padding: 1rem;
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.55);
border-radius: 4px;
color: $grey-bright;
box-sizing: border-box;
font-family: $text-font;
transition: all 300ms ease;
@media all and(max-height: 800px) { @media all and(max-height: 800px) {
max-height: 85px; max-height: 85px;
padding: 6%;
} }
@media all and(max-height: 730px) { @media all and(max-height: 730px) {
max-height: 70px; max-height: 70px;
padding: 3%;
} }
&.finished { &.finished {
border: 1px solid #7b7b7b; border: 1px solid #7b7b7b;
background: $dark-2; background: $dark-light-2;
& > * { & > * {
color: $grey-dark; color: $grey-dark !important;
} }
} }
&:hover {
cursor: pointer; &.duelCard {
} background: $dark-3;
.content { border: solid 1px rgba(97, 240, 242, 0.5);
display: flex; &.active {
flex-direction: column; background: $grey-linear-gradient-background;
align-self: center; }
justify-content: space-between;
align-items: flex-start;
span { span {
margin-bottom: 0.3em; justify-content: space-between !important;
} }
} }
.spinner-container {
height: 3.75rem; &.goDuel {
width: 3.75rem; background: $blue-gradient;
margin: auto; span {
} color: $dark-light-2 !important;
.cardIcon { justify-content: space-between !important;
margin-right: 1rem; font-weight: 700;
}
span {
font-size: 1.1rem;
font-weight: 700;
display: block;
margin-bottom: 0.6rem;
@media all and(max-height: 700px) {
margin-bottom: 0.1rem;
font-size: 1rem;
} }
} }
.challengeminIcon {
filter: drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.55)); span.MuiButton-label {
}
.duelLocked {
margin-left: auto;
}
.starCount {
display: flex; display: flex;
align-items: center; justify-content: flex-start;
margin: 0; padding: 1rem 0.5rem;
color: $grey-bright;
transition: all 300ms ease;
text-transform: capitalize;
.content {
display: flex;
flex-direction: column;
align-items: flex-start;
text-transform: capitalize;
.stars {
display: flex;
gap: 2px;
}
}
.spinner-container {
height: 3.75rem;
width: 3.75rem;
margin: auto;
}
.cardIcon {
margin-right: 1rem;
}
span { span {
margin: 0; font-size: 1.1rem;
font-weight: 700;
@media all and(max-height: 700px) {
font-size: 1rem;
}
} }
.blueNumber { .challengeminIcon {
font-weight: 900; filter: drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.55));
color: $blue-light;
margin: 0 0.3rem 0 0.7rem;
} }
}
.finalDuel {
display: flex;
flex-direction: column;
.starCount { .starCount {
display: flex;
align-items: center;
margin: 0;
span { span {
font-size: 1rem; margin: 0;
font-weight: 500;
} }
.blueNumber { .blueNumber {
margin-left: 0; font-weight: 900;
color: $blue-light;
margin: 0 0.3rem 0 0.7rem;
} }
} }
&.result { .finalDuel {
span { display: flex;
margin-bottom: 0.2rem; flex-direction: column;
font-weight: 600; align-items: flex-start;
font-size: 1rem; .starCount {
span {
font-size: 1rem;
font-weight: 500;
}
.blueNumber {
margin-left: 0;
}
}
&.result {
span {
margin-bottom: 0.2rem;
font-weight: 600;
font-size: 1rem;
}
} }
} }
} }
} }
.duelCard {
background: $dark-3;
border: solid 1px rgba(97, 240, 242, 0.5);
align-items: center;
justify-content: space-between;
position: relative;
&.active {
background: $grey-linear-gradient-background;
}
}
.explorationCard,
.actionCard {
position: relative;
}
.goDuel {
align-items: center;
justify-content: space-between;
height: auto;
background: $blue-gradient;
color: $dark-light-2;
font-weight: 700;
font-family: $text-font;
}
.notifChallenge {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
right: 4px;
top: 4px;
width: 1.25rem;
height: 1.25rem;
color: $dark-light;
border-radius: 50%;
border: 1px solid $dark-light;
z-index: 1;
background: $blue-radial-gradient;
font-size: 12px;
}
import { Button } from '@material-ui/core'
import FormNavigation from 'components/FormGlobal/FormNavigation' import FormNavigation from 'components/FormGlobal/FormNavigation'
import FormProgress from 'components/FormGlobal/FormProgress' import FormProgress from 'components/FormGlobal/FormProgress'
import 'components/ProfileType/profileTypeForm.scss' import 'components/ProfileType/profileTypeForm.scss'
...@@ -77,13 +78,13 @@ const ProfileTypeFormNumberSelection: React.FC< ...@@ -77,13 +78,13 @@ const ProfileTypeFormNumberSelection: React.FC<
</div> </div>
{answer !== null ? ( {answer !== null ? (
<div className={'number-container'}> <div className={'number-container'}>
<button <Button
className={'btn-profile-number'} className={'btn-profile-number'}
onClick={() => decrement()} onClick={() => decrement()}
disabled={index < 1} disabled={index < 1}
> >
- -
</button> </Button>
<label className={'number'}> <label className={'number'}>
<input <input
type={'text'} type={'text'}
...@@ -92,13 +93,13 @@ const ProfileTypeFormNumberSelection: React.FC< ...@@ -92,13 +93,13 @@ const ProfileTypeFormNumberSelection: React.FC<
disabled={true} disabled={true}
/> />
</label> </label>
<button <Button
className={'btn-profile-number'} className={'btn-profile-number'}
onClick={() => increment()} onClick={() => increment()}
disabled={index >= answerType.choices.length - 1} disabled={index >= answerType.choices.length - 1}
> >
+ +
</button> </Button>
</div> </div>
) : null} ) : null}
</div> </div>
......
...@@ -140,13 +140,9 @@ ...@@ -140,13 +140,9 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin: 0.5rem; margin: 0.5rem;
&:disabled {
// &:focus { color: rgba($color: $white, $alpha: 0.5);
// outline: none; }
// }
}
button:disabled {
opacity: 0.5;
} }
.date-select { .date-select {
margin: 0.5em; margin: 0.5em;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment