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

revamped Stock listing page UI, closes #298 #302

Open
wants to merge 3 commits into
base: develop
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
55 changes: 40 additions & 15 deletions components/stock-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export const Card = ({ stock, operationType }) => {
return (
<div className="stock-card">
<Image
src={path.join('/assets', 'stocks.jpg')}
src={path.join('/assets', 'stock.png')}
alt={stock.name || stock.stockName}
width={100}
height={100}
width={87}
height={86}
objectFit="cover"
layout="fixed"
/>
Expand All @@ -25,13 +25,22 @@ export const Card = ({ stock, operationType }) => {
<p className="stock-card-product-name">
{stock.name || stock.stockName}
</p>
<p className="stock-card-product-price">
{stock.price || stock.initialStockValue} 💲
</p>
<p className="stock-card-product-quantity">
{' '}
Quantity : {stock.quantity}
</p>
<p className="stock-card-product-price">
<i className="dollar">
<Image
src={path.join('/assets', 'dollar.png')}
alt={"dollar sign"}
width={18}
height={18}
objectFit="cover"
layout="fixed"
/>
</i> {stock.price || stock.initialStockValue}
</p>
<div>
<StockOperation
stockId={finalId}
Expand All @@ -47,16 +56,18 @@ export const Card = ({ stock, operationType }) => {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
justify-content: flex-start;
font-family: 'Poppins';
margin: 10px;
padding-top: 16px;
border: 1px solid #eee;
box-shadow: 0 2px 2px #ccc;
text-align: center;
min-width: 300px;
border-radius: 4px;
min-width: 250px;
min-height: 297px;
border-radius: 1.5em;
transition: 0.2s;
background: #ffffff;
background: #F6FDFB;
}
.stock-card:hover {
box-shadow: 0px 4px 10px #ccc;
Expand All @@ -70,26 +81,40 @@ export const Card = ({ stock, operationType }) => {
text-align: center;
width: 100%;
padding: 1rem;
background-color: #ffffff;
background-color: #F6FDFB;
border-radius: 1.5em;
}

.stock-card-product-name {
font-weight: bold;
font-size: 1.3em;
font-weight: 500;
font-size: 1.125em;
color: #540075;
margin: 0;
}
p {
margin-block-start: 0.5rem;
margin-block-end: 0.5rem;
}
.stock-card-product-price {
font-weight: bold;
font-size: 1.3em;
font-size: 1.125em;
color: #e30062;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}
.stock-card-product-price .dollar{
font-style: normal;
font-size: 1.1em;
display: flex;
justify-content: center;
align-items: end;
}
.stock-card-product-quantity {
font-size: 1.3em;
font-size: 0.875em;
color: #540075;
margin: 2px;
}
`}
</style>
Expand Down
4 changes: 2 additions & 2 deletions components/stock-operation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const StockOperation = (props) => {
<div className={styles.buttonWrapper}>
{router.pathname == '/trading' && (
<div
className={`${styles.button} ${styles.greenButton}`}
className={`${styles.button} ${styles.blueButton}`}
onClick={() => setTransaction('BUY')}
>
BUY
Buy Now
</div>
)}
{router.pathname == '/trading/sell' && (
Expand Down
23 changes: 17 additions & 6 deletions pages/trading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ const Invest = () => {
<div className="main-container">
<div className="layout">
<div className="content">
<div className="stocks-header">
<Link href="/trading/sell">
<div className={`${styles.trade}`}>Sell Stocks</div>
</Link>
<h2>Stocks</h2>
</div>
<div className="shoppinglist-container">
{stocks.map((itemName) => (
<Card
Expand All @@ -33,11 +39,6 @@ const Invest = () => {
/>
))}
</div>
<div>
<Link href="/trading/sell">
<div className={`${styles.trade}`}>Sell Stocks</div>
</Link>
</div>
</div>
<Footer />
</div>
Expand All @@ -46,7 +47,6 @@ const Invest = () => {
min-height: calc(100vh-58px);
position: relative;
}

.content {
min-height: 87vh;
padding-bottom: 75px;
Expand All @@ -57,6 +57,17 @@ const Invest = () => {
justify-content: space-evenly;
align-items: stretch;
}
.stocks-header{
display: flex;
flex-direction: column;
padding: 0rem 5rem;
}
.stocks-header h2{
font-family: 'Poppins';
font-weight: 600;
font-size: 1.375rem;
line-height: 2rem;
}
`}</style>
</div>
</>
Expand Down
Binary file added public/assets/dollar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/stock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 29 additions & 8 deletions styles/Home.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@700&display=swap');

.leftSection {
display: flex;
flex-direction: column;
Expand All @@ -21,13 +25,24 @@
font-size: 20px;
cursor: pointer;
margin: 1.5rem 1.5rem 0 1.5rem;
width: 7rem;
width: 8rem;
}
.greenButton {
background-color: #2ecc71;
text-align: center;
border: none;
}
.blueButton {
width: 9.6rem;
height: 2.75rem;
font-family: 'Work Sans', sans-serif;
background-color: #041187;
font-size: 1rem;
text-align: center;
border: none;
border-radius: 0.625em;
margin-top: 2.125em;
}
.redButton {
background-color: #ff3838;
text-align: center;
Expand Down Expand Up @@ -74,15 +89,21 @@
}

.trade {
width: 100%;
text-align: center;
width: 13.125rem;
height: 3.125rem;
align-self: end;
margin: 0;
padding: 1rem;
display: block;
color:#540075;
font-weight: bold;
font-size: 1.2rem;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Heebo', sans-serif;
font-size: 0.875rem;
font-weight: 700;
line-height: 1.313rem;
color: #FFFFFF;
cursor: pointer;
border-radius: 0.3rem;
background-color: #0094B6;
}

@media only screen and (max-width: 600px) {
Expand Down
2 changes: 1 addition & 1 deletion styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
background-color: #e9ebff;
background-color: #ffffff;
min-height: 100%;
}
@media only screen and (min-width: 905px) {
Expand Down