generated from EasyWebApp/WebCell-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[optimize] simplify Simple Scroll List components
- Loading branch information
Showing
11 changed files
with
160 additions
and
203 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,42 +1,29 @@ | ||
import { observer } from 'mobx-react'; | ||
import { ScrollListProps } from 'mobx-restful-table'; | ||
import { FC } from 'react'; | ||
import { Col, Row } from 'react-bootstrap'; | ||
|
||
import { GitTemplate, GitTemplateModal } from '../../models/TemplateRepo'; | ||
import { XScrollList, XScrollListProps } from '../layout/ScrollList'; | ||
import { GitTemplate } from '../../models/TemplateRepo'; | ||
import { GitCard, GitCardProps } from './Card'; | ||
|
||
export interface GitListProps | ||
extends XScrollListProps<GitTemplate>, | ||
Pick<GitCardProps, 'renderController'> { | ||
store: GitTemplateModal; | ||
} | ||
export type GitListLayoutProps = Pick< | ||
ScrollListProps<GitTemplate>, | ||
'defaultData' | ||
> & | ||
Pick<GitCardProps, 'renderController'>; | ||
|
||
@observer | ||
export class GitList extends XScrollList<GitListProps> { | ||
store = this.props.store; | ||
|
||
constructor(props: GitListProps) { | ||
super(props); | ||
|
||
this.boot(); | ||
} | ||
|
||
renderList() { | ||
const { renderController } = this.props, | ||
{ allItems } = this.store; | ||
|
||
return ( | ||
<Row as="ul" className="list-unstyled g-4" xs={1} sm={2}> | ||
{allItems.map(item => ( | ||
<Col as="li" key={item.id}> | ||
<GitCard | ||
className="h-100 shadow-sm" | ||
{...item} | ||
renderController={renderController} | ||
/> | ||
</Col> | ||
))} | ||
</Row> | ||
); | ||
} | ||
} | ||
export const GitListLayout: FC<GitListLayoutProps> = ({ | ||
defaultData, | ||
renderController, | ||
}) => ( | ||
<Row as="ul" className="list-unstyled g-4" xs={1} sm={2}> | ||
{defaultData?.map(item => ( | ||
<Col as="li" key={item.id}> | ||
<GitCard | ||
className="h-100 shadow-sm" | ||
{...item} | ||
renderController={renderController} | ||
/> | ||
</Col> | ||
))} | ||
</Row> | ||
); |
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,42 +1,29 @@ | ||
import { observer } from 'mobx-react'; | ||
import { ScrollListProps } from 'mobx-restful-table'; | ||
import { FC } from 'react'; | ||
import { Col, Row } from 'react-bootstrap'; | ||
|
||
import { GitModel, GitRepository } from '../../models/Git'; | ||
import { XScrollList, XScrollListProps } from '../layout/ScrollList'; | ||
import { GitRepository } from '../../models/Git'; | ||
import { GitTeamCard, GitTeamCardProps } from './GitTeamCard'; | ||
|
||
export interface GitListProps | ||
extends XScrollListProps<GitRepository>, | ||
Pick<GitTeamCardProps, 'renderController'> { | ||
store: GitModel; | ||
} | ||
export type TeamGitListLayoutProps = Pick< | ||
ScrollListProps<GitRepository>, | ||
'defaultData' | ||
> & | ||
Pick<GitTeamCardProps, 'renderController'>; | ||
|
||
@observer | ||
export class TeamGitList extends XScrollList<GitListProps> { | ||
store = this.props.store; | ||
|
||
constructor(props: GitListProps) { | ||
super(props); | ||
|
||
this.boot(); | ||
} | ||
|
||
renderList() { | ||
const { renderController } = this.props, | ||
{ allItems } = this.store; | ||
|
||
return ( | ||
<Row as="ul" className="list-unstyled g-4" xs={1} sm={2}> | ||
{allItems.map(item => ( | ||
<Col as="li" key={item.id}> | ||
<GitTeamCard | ||
className="h-100 shadow-sm" | ||
{...item} | ||
renderController={renderController} | ||
/> | ||
</Col> | ||
))} | ||
</Row> | ||
); | ||
} | ||
} | ||
export const TeamGitListLayout: FC<TeamGitListLayoutProps> = ({ | ||
defaultData, | ||
renderController, | ||
}) => ( | ||
<Row as="ul" className="list-unstyled g-4" xs={1} sm={2}> | ||
{defaultData?.map(item => ( | ||
<Col as="li" key={item.id}> | ||
<GitTeamCard | ||
className="h-100 shadow-sm" | ||
{...item} | ||
renderController={renderController} | ||
/> | ||
</Col> | ||
))} | ||
</Row> | ||
); |
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
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
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.