forked from binary-com/deriv-app
-
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.
Merge pull request #19 from yauheni-kryzhyk-deriv/yauheni/76938/timel…
…ine_ts_migration Yauheni/76938/timeline ts migration
- Loading branch information
Showing
3 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...mponents/src/components/timeline/index.js → ...mponents/src/components/timeline/index.ts
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,4 +1,4 @@ | ||
import Timeline from './timeline.jsx'; | ||
import Timeline from './timeline'; | ||
import './timeline.scss'; | ||
|
||
export default Timeline; |
This file was deleted.
Oops, something went wrong.
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,50 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
import Text from '../text'; | ||
|
||
type TOval = { | ||
children: number; | ||
}; | ||
type TItem = React.HTMLAttributes<HTMLDivElement> & { item_title: React.ReactNode }; | ||
type TTimeline = React.HTMLAttributes<HTMLDivElement> & { disabled_items?: number[] }; | ||
|
||
const Oval = ({ children }: TOval) => { | ||
return ( | ||
<div className='dc-timeline__oval'> | ||
<Text color='colored-background' size='s' weight='bold' className='dc-timeline__number'> | ||
{children} | ||
</Text> | ||
</div> | ||
); | ||
}; | ||
|
||
const Timeline = ({ children, disabled_items, ...props }: React.PropsWithChildren<TTimeline>) => { | ||
return ( | ||
<div {...props}> | ||
{Array.isArray(children) && | ||
children.map((child, idx) => ( | ||
<div | ||
key={idx} | ||
className={classNames('dc-timeline__flex', { | ||
'dc-timeline__flex--no-border': children.length === idx + 1, | ||
'dc-timeline__flex--disabled': disabled_items?.includes(idx + 1), | ||
})} | ||
> | ||
<Oval>{idx + 1}</Oval> | ||
<div className='dc-timeline__container'> | ||
<Text as='h2' color='prominent' size='xs' className='dc-timeline__title'> | ||
{child.props.item_title} | ||
</Text> | ||
<div className='dc-timeline__content'>{child}</div> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
const Item = ({ children, ...props }: React.PropsWithChildren<TItem>) => <div {...props}>{children}</div>; | ||
|
||
Timeline.Item = Item; | ||
|
||
export default Timeline; |