Skip to content

Commit

Permalink
refactor: css changing on selection
Browse files Browse the repository at this point in the history
  • Loading branch information
devsakae committed Aug 17, 2023
1 parent 0a6b9f8 commit 2d7a7d4
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 9 deletions.
53 changes: 50 additions & 3 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,25 @@ header p {
justify-content: space-between;
}

.selected {
background-image: linear-gradient(62deg, #d62424 0%, #ed810d 100%);
color: #ffffff;
font-weight: 700;
box-shadow: 0 0 0.2em rgba(0, 0, 0, 0.0625);
}

@media screen and (max-width: 480px) {
.item {
width: 94vw;
padding: 0.5em 0.3em;
display: flex;
align-items: center;
justify-content: space-between;
line-height: 1.3rem;
text-align: left;
}
}

.dark .item {
background: rgb(28,28,52);
background: linear-gradient(90deg, rgba(28,28,52,1) 43%, rgba(24,24,50,1) 100%);
Expand All @@ -197,7 +216,7 @@ header p {
box-shadow: 0px 5px 94px -13px rgba(0,0,0,0.75);
}

.itemLucas {
/* .itemLucas {
align-items: center;
background-image: linear-gradient(62deg, #f77c6a 0%, #f1ae9e 100%);
border-radius: 1em;
Expand All @@ -214,7 +233,7 @@ box-shadow: 0px 5px 94px -13px rgba(0,0,0,0.75);
-webkit-box-shadow: 0px 5px 94px -13px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 5px 94px -13px rgba(0,0,0,0.75);
box-shadow: 0px 5px 94px -13px rgba(0,0,0,0.75);
}
} */

.item-product input {
margin-right: 15px;
Expand Down Expand Up @@ -256,6 +275,12 @@ box-shadow: 0px 5px 94px -13px rgba(0,0,0,0.75);
padding: 2em;
}

@media screen and (max-width: 480px) {
.cronometro {
max-width: 95vw;
}
}

.dark .cronometro {
background: var(--weirdGradientColor);
-webkit-box-shadow: 0px 5px 67px -23px rgba(0,0,0,0.75);
Expand Down Expand Up @@ -498,4 +523,26 @@ blockquote:after {
color: inherit;
}

/*--------- END --------*/
.customInput {
max-width: 50px;
min-height: 30px;
text-align: center;
font-size: large;
letter-spacing: 0.1rem;
margin: 0 -20px 0 5px;
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}


/*--------- END --------*/
15 changes: 13 additions & 2 deletions src/components/Acao.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import React, { Component } from 'react';

export default class Acao extends Component {
state = {
selected: false,
}

selection = (e) => {
this.props.check(e);
this.setState(prev => ({ ...prev, selected: !prev.selected }))
}

render() {
const { content, value, name } = this.props.frase;


return (
<label htmlFor={ this.props.value }>
<div className='item'>
<div className={ `item ${this.state.selected && 'selected'}` }>
<div className='item-product'>
<input
id={ this.props.idx }
value={ value }
type='checkbox'
disabled={ this.props.started }
onChange={(e) => this.props.check(e)}
onChange={(e) => this.selection(e)}
/>
{ content }
</div>
Expand Down
50 changes: 50 additions & 0 deletions src/components/AcaoCustom.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { Component } from 'react';

export default class AcaoCustom extends Component {
state = {
minutes: 30,
adding: false,
};

addMinutes = (e) => {
this.setState({
minutes: e.target.value,
});
};

changingCustom = (e) => {
this.setState((prev) => ({ ...prev, adding: !prev.adding }));
console.log(this.state);
this.props.check(e);
};

render() {
return (
<label htmlFor='custom'>
<div className={ `item ${this.state.adding && 'selected'}` }>
<div className='item-product'>
<input
id='custom'
type='checkbox'
value={this.state.minutes}
disabled={this.props.started}
// checked={ this.state.adding }
onChange={(e) => this.changingCustom(e)}
/>
Preciso de mais
<input
className='customInput'
type='number'
placeholder='30'
max={1200}
value={this.state.minutes}
disabled={this.state.adding}
onChange={(e) => this.addMinutes(e)}
/>
minutos
</div>
</div>
</label>
);
}
}
4 changes: 3 additions & 1 deletion src/components/Acoes.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import Acao from './Acao';
import AcaoCustom from './AcaoCustom';
// Importação graças a ajuda do Washington
const actions = require('../conteudo/acoes');

Expand Down Expand Up @@ -33,7 +34,8 @@ export default class Acoes extends Component {
{frases &&
frases?.map((frase, idx) => (
<Acao frase={ frase } key={ idx } started={ this.props.started } check={ check } />
))}
))}
<AcaoCustom started={ this.props.started } check={ check } />
</div>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Timer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class Timer extends Component {
}
if (segundos === 0) {
if (minutos === 0) {
clearInterval(this.myInterval)
clearInterval(this.myInterval);
} else {
this.setState(({ minutos }) => ({
minutos: minutos - 1,
Expand Down
4 changes: 2 additions & 2 deletions src/conteudo/acoes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const actions = {
umemeio: {
value: 1.5,
name: '1 min 30 seg',
actions: ['Descascar uma fruta', 'Pegar um chocolatinho', 'Passar um café de máquina', 'Olhar o WhatsApp', 'Limpar o monitor'],
actions: ['Descascar uma fruta', 'Pegar um chocolatinho', 'Passar um café', 'Olhar o WhatsApp', 'Limpar o monitor'],
},
dois: {
value: 2,
name: '2 minutos',
actions: ['Dar uma olhada no Slack', 'Ler o course de novo', 'Passar 1 fase do Candy Crush', 'Fazer um sanduíche', 'Treinar seu pitch'],
actions: ['Ver o Slack', 'Ler o course de novo', 'Jogar Candy Crush', 'Fazer um sanduíche', 'Treinar seu pitch'],
},
doisemeio: {
value: 2.5,
Expand Down

1 comment on commit 2d7a7d4

@vercel
Copy link

@vercel vercel bot commented on 2d7a7d4 Aug 17, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.