Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitkumawat1m committed Oct 24, 2023
1 parent 4d2b67d commit 12a312a
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions packages/kitchen-sink/src/examples/discount-calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { block } from 'million/react';
interface Results {
discountPrice: number;
finalPrice: number;
}
}



Expand All @@ -22,51 +22,51 @@ const DiscountCalculator = block(() => {
if (isNaN(p) || isNaN(r) || p <= 0 || r <= 0 ) {
alert('Please enter valid numbers.');
return;
}
}

const discountPrice = p * r;
const finalPrice = p - discountPrice;

setResults({
discountPrice,
finalPrice,
});
});
}


return (
return (
<div className='Discount Calculator'>
<h1>Discount Calculator</h1>
<div>
<h1>Discount Calculator</h1>
<div>
<label>Original Price ($): </label>
<input
type="number"
value={originalPrice}
onChange={(e) => setOriginalPrice(e.target.value)}
style={{ display: 'block', marginBottom: '15px' }}
type="number"
value={originalPrice}
onChange={(e) => setOriginalPrice(e.target.value)}
style={{ display: 'block', marginBottom: '15px' }}
/>
</div>
<div>
</div>
<div>
<label>Discount (% off): </label>
<input
type="number"
value={discountRate}
onChange={(e) => setDiscountRate(e.target.value)}
style={{ display: 'block', marginBottom: '15px' }}
type="number"
value={discountRate}
onChange={(e) => setDiscountRate(e.target.value)}
style={{ display: 'block', marginBottom: '15px' }}
/>
</div>
<button onClick={calculateDiscount}>Calculate</button>
</div>
<button onClick={calculateDiscount}>Calculate</button>


{results && (
{results && (
<div className="results">
<h2>Results:</h2>
<div>Final Price : ${results.finalPrice.toFixed(2)}</div>
<div>You Save : ${results.discountPrice.toFixed(2)}</div>
</div>
)}
)}
</div>
);
);
});

export default DiscountCalculator;

0 comments on commit 12a312a

Please sign in to comment.