-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
120 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
import React from 'react'; | ||
import styles from './styles.module.scss'; | ||
import { ShareIntro } from '@/components/ShareIntro'; | ||
import { Button } from '@/components/Button'; | ||
import { BuyStock } from '@/components/BuyStock'; | ||
import { serviceShares } from '@/services'; | ||
|
||
const data = { | ||
brand: { bg: '#1a5ea0', color: 'white' }, | ||
}; | ||
|
||
const ItemPage = async ({ params }: { params: { slug: string } }) => { | ||
const res = await serviceShares.getByTicker(params.slug); | ||
console.log(res, res) | ||
const PageStock = async ({ params }: { params: { slug: string } }) => { | ||
const { data } = await serviceShares.getByTicker(params.slug); | ||
const { data: dataLastPrice } = await serviceShares.getLastPriceByTicker( | ||
params.slug, | ||
); | ||
return ( | ||
<div className={styles.page}> | ||
<div className={styles.main}> | ||
{/*@ts-ignore*/} | ||
<ShareIntro value={data} /> | ||
</div> | ||
<div className={styles.side}> | ||
<div> | ||
<div> | ||
<Button>BUY</Button> | ||
</div> | ||
</div> | ||
<BuyStock info={dataLastPrice} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ItemPage; | ||
export default PageStock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
.main { | ||
flex: 1; | ||
max-width: 920px; | ||
margin-right: 120px; | ||
margin-right: 30px; | ||
} | ||
.side { | ||
|
||
flex: 0 0 300px | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.page { | ||
min-height: 775px; | ||
max-width: var(--box-max-width); | ||
margin: 0 auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import styles from './styles.module.scss'; | ||
|
||
interface Price { | ||
units: string; | ||
nano: number; | ||
} | ||
|
||
interface PriceInfo { | ||
figi: string; | ||
price: Price; | ||
time: string; | ||
instrumentUid: string; | ||
lastPriceType: string; | ||
} | ||
|
||
export const BuyStock: React.FC<{ info: PriceInfo }> = ({ info }) => { | ||
const formattedDate = new Date(info.time).toLocaleString(); | ||
const formattedPrice = parseFloat( | ||
`${info.price.units}.${info.price.nano / 1e9}`, | ||
).toFixed(2); | ||
|
||
return ( | ||
<div className={styles.box}> | ||
<div>Date: {formattedDate}</div> | ||
<div>Price: {formattedPrice}</div> | ||
<button className={styles.buyButton}>Buy</button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './BuyStock'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.box { | ||
padding: 20px; | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
width: 300px; | ||
text-align: center; | ||
} | ||
|
||
.buyButton { | ||
margin-top: 15px; | ||
padding: 10px 20px; | ||
background-color: #4caf50; | ||
color: white; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
.buyButton:hover { | ||
background-color: #45a049; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { FC } from 'react'; | ||
|
||
export const ProfileBalance: FC = () => { | ||
return <span>1000 $</span>; | ||
return <span>1000</span>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters