" my chnage ui and functionlity"

new_001
sonali 2024-10-08 11:53:12 +05:30
parent b9bcc584dd
commit e50026b7a2
7 changed files with 101 additions and 24 deletions

View File

@ -99,9 +99,29 @@
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
} }
.btn-group{
display: flex;
position: relative;
}
.minus{
width: 60px;
background-color: #1E1E1E;
color: #fff;
box-shadow: -8px -8px 12px rgba(39, 39, 44, 0.48),
8px 8px 16px rgba(4, 4, 4, 0.8),
inset -2px -2px 2px rgba(41, 37, 41, 0.64),
inset 2px 2px 2px #181618;
}
.plus{
width: 60px;
background-color: #1E1E1E;
color: #fff;
box-shadow: -8px -8px 12px rgba(39, 39, 44, 0.48),
8px 8px 16px rgba(4, 4, 4, 0.8),
inset -2px -2px 2px rgba(41, 37, 41, 0.64),
inset 2px 2px 2px #181618;
}
@media (max-width: 600px) { @media (max-width: 600px) {

View File

@ -10,19 +10,21 @@ function ExpenseAmount() {
const location = useLocation(); const location = useLocation();
const { entryType } = location.state || {}; const { entryType } = location.state || {};
const [totalAmount, setTotalAmount] = useOutletContext(); const [totalAmount, setTotalAmount] = useOutletContext();
const [isClickable, setIsClickable] = useState(true); const [isClickable, setIsClickable] = useState(true);
const [lastAddedAmount, setLastAddedAmount] = useState(0); const [lastAddedAmount, setLastAddedAmount] = useState(0);
const handleCoinClick = (amount) => { const handleCoinClick = (coinAmount) => {
if (isClickable) { if (isClickable) {
setTotalAmount((prevAmount) => prevAmount + amount); // Update totalAmount based on coin click
setLastAddedAmount(amount); const newAmount = parseFloat(totalAmount) + coinAmount;
setTotalAmount(newAmount); // Update the total amount
setLastAddedAmount(coinAmount); // Update the last added amount
setIsClickable(false); setIsClickable(false);
setTimeout(() => { setTimeout(() => {
setIsClickable(true); setIsClickable(true);
}, 500); }, 500);
} }
}; };
const handleSubtractClick = (amount) => { const handleSubtractClick = (amount) => {
@ -75,10 +77,18 @@ function ExpenseAmount() {
</section> </section>
<div className="btn-group"> <div className="btn-group">
<button onClick={() => handleSubtractClick(lastAddedAmount)} disabled={lastAddedAmount === 0}> <button
className="minus"
onClick={() => handleSubtractClick(lastAddedAmount)}
disabled={lastAddedAmount === 0}
>
- -
</button> </button>
<button onClick={() => handleCoinClick(lastAddedAmount)}> <button
className="plus"
onClick={() => handleCoinClick(lastAddedAmount)}
disabled={lastAddedAmount === 0}
>
+ +
</button> </button>
</div> </div>

View File

@ -9,10 +9,9 @@ body {
flex-direction: column; flex-direction: column;
position: fixed; position: fixed;
width: 80%; width: 80%;
max-width: 500px; max-width: 900px;
height: 340px; height: 340px;
top: 32%; top: 32%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
color: white; color: white;
@ -63,7 +62,7 @@ body {
.button-group { .button-group {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 80%; width: 40%;
margin: 20px auto; margin: 20px auto;
} }
@ -105,9 +104,7 @@ body {
} }
.button-group { .button-group {
flex-direction: row;
align-items: center;
gap: 15px;
} }
.add-entry-1, .add-entry-1,
@ -115,6 +112,18 @@ body {
width: 50%; width: 50%;
margin: 5px 0; margin: 5px 0;
} }
.button-group {
display: flex;
justify-content: space-between;
width: 80%;
margin: 20px auto;
flex-direction: row;
align-items: center;
gap: 15px;
}
} }
@media (max-width: 480px) { @media (max-width: 480px) {

View File

@ -19,7 +19,7 @@
} }
.arrow-icon { .arrow-icon {
font-size: 24px; font-size: 18px;
} }
/* /*
@ -134,11 +134,15 @@ transition: border-color 0.3s ease, background-color 0.3s ease;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
.category-titles { .category-titles {
font-size: 20px; font-size: 20px;
} }
.arrow{ .arrow{
margin: 13px 10px; margin: 13px 10px;
} }

View File

@ -14,6 +14,8 @@
.arrow { .arrow {
font-size: 18px; font-size: 18px;
cursor: pointer; cursor: pointer;
margin: 15px;
margin-top: 35px ;
} }
.arr { .arr {

View File

@ -97,6 +97,29 @@
} }
.btn-group{
display: flex;
position: relative;
}
.minus{
width: 60px;
background-color: #1E1E1E;
color: #fff;
box-shadow: -8px -8px 12px rgba(39, 39, 44, 0.48),
8px 8px 16px rgba(4, 4, 4, 0.8),
inset -2px -2px 2px rgba(41, 37, 41, 0.64),
inset 2px 2px 2px #181618;
}
.plus{
width: 60px;
background-color: #1E1E1E;
color: #fff;
box-shadow: -8px -8px 12px rgba(39, 39, 44, 0.48),
8px 8px 16px rgba(4, 4, 4, 0.8),
inset -2px -2px 2px rgba(41, 37, 41, 0.64),
inset 2px 2px 2px #181618;
}
.coin-value { .coin-value {

View File

@ -10,19 +10,21 @@ function AmountPage() {
const location = useLocation(); const location = useLocation();
const { entryType } = location.state || {}; const { entryType } = location.state || {};
const [totalAmount, setTotalAmount] = useOutletContext(); const [totalAmount, setTotalAmount] = useOutletContext();
const [isClickable, setIsClickable] = useState(true); const [isClickable, setIsClickable] = useState(true);
const [lastAddedAmount, setLastAddedAmount] = useState(0); const [lastAddedAmount, setLastAddedAmount] = useState(0);
const handleCoinClick = (amount) => { const handleCoinClick = (coinAmount) => {
if (isClickable) { if (isClickable) {
setTotalAmount((prevAmount) => prevAmount + amount); // Update totalAmount based on coin click
setLastAddedAmount(amount); const newAmount = parseFloat(totalAmount) + coinAmount;
setTotalAmount(newAmount); // Update the total amount
setLastAddedAmount(coinAmount); // Update the last added amount
setIsClickable(false); setIsClickable(false);
setTimeout(() => { setTimeout(() => {
setIsClickable(true); setIsClickable(true);
}, 500); }, 500);
} }
}; };
const handleSubtractClick = (amount) => { const handleSubtractClick = (amount) => {
@ -75,15 +77,22 @@ function AmountPage() {
</section> </section>
<div className="btn-group"> <div className="btn-group">
<button onClick={() => handleSubtractClick(lastAddedAmount)} disabled={lastAddedAmount === 0}> <button
className="minus"
onClick={() => handleSubtractClick(lastAddedAmount)}
disabled={lastAddedAmount === 0}
>
- -
</button> </button>
<button onClick={() => handleCoinClick(lastAddedAmount)}> <button
className="plus"
onClick={() => handleCoinClick(lastAddedAmount)}
disabled={lastAddedAmount === 0}
>
+ +
</button> </button>
</div> </div>
</div> </div>
); );
} }
export default AmountPage; export default AmountPage;