-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: construct the workbench struct
- Loading branch information
Showing
15 changed files
with
146 additions
and
201 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,4 @@ | ||
.scroll { | ||
width: 10px; | ||
pointer-events: none; | ||
} |
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 @@ | ||
export type ReactType = React.PureComponent | React.ReactElement | React.Component | React.FunctionComponent | null; |
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,10 +1,20 @@ | ||
@import '@/style/const.scss'; | ||
|
||
.#{$prefix}-activityBar { | ||
$activityBar: 'activityBar'; | ||
|
||
.#{$prefix}-#{$activityBar} { | ||
position: absolute; | ||
width: 48px; | ||
height: 100%; | ||
z-index: 1; | ||
// TODO temp style, just for development | ||
background-color: rgb(51, 51, 51); | ||
} | ||
|
||
.#{$activityBar}-item { | ||
position: relative; | ||
width: 48px; | ||
height: 48px; | ||
z-index: 1; | ||
display: flex; | ||
} |
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,15 +1,51 @@ | ||
import * as React from 'react'; | ||
|
||
import { prefixClaName } from '@/common/className'; | ||
import { IActivityBarData, IActivityBar } from '@/core/activityBar'; | ||
|
||
import './activityBar.scss'; | ||
|
||
export const ActivityBar: React.FunctionComponent = function() { | ||
export interface IActivityBarProps { | ||
activityBar: IActivityBar; | ||
} | ||
|
||
export const ROOT_CLASS_NAME = 'activityBar'; | ||
|
||
export const ActivityBarItem = React.memo(function FnActivityBarItem(props: IActivityBarData) { | ||
const { id, name = '', data = {}, render } = props; | ||
if (render) { | ||
return render(); | ||
} | ||
return ( | ||
<a | ||
className={prefixClaName('item', ROOT_CLASS_NAME)} | ||
title={name} key={id} | ||
data-item={data} | ||
> | ||
{name} | ||
</a> | ||
); | ||
}); | ||
|
||
export const ActivityBar = React.memo(function FnActivityBar(props: IActivityBarProps) { | ||
const { activityBar } = props; | ||
|
||
let content = activityBar.data?.map((item: IActivityBarData) => ( | ||
<ActivityBarItem key={item.id} {...item}/> | ||
)); | ||
if (activityBar.render) { | ||
content = activityBar.render(); | ||
} | ||
|
||
const onClick = (e: React.MouseEvent) => { | ||
activityBar.onClick(e, {} as any ); | ||
}; | ||
|
||
return ( | ||
<div className={prefixClaName('activityBar')}> | ||
ActivityBar | ||
<div className={prefixClaName(ROOT_CLASS_NAME)} onClick={onClick}> | ||
{content} | ||
</div> | ||
); | ||
}; | ||
}); | ||
|
||
export default ActivityBar; |
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
Oops, something went wrong.