-
Notifications
You must be signed in to change notification settings - Fork 89
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
6 changed files
with
47 additions
and
69 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
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,39 @@ | ||
import { MenuItem } from "@mui/material"; | ||
import { match } from "assert"; | ||
|
||
interface HighlightMenuItemProps extends React.ComponentProps<typeof MenuItem>{ | ||
condition: boolean; | ||
customColor?: string; | ||
} | ||
|
||
export const HighlightMenuItem = ({ condition, children, customColor = 'yellow', ...props }: HighlightMenuItemProps) => { | ||
const highlightStyle = { | ||
backgroundColor: customColor, | ||
}; | ||
return ( | ||
<MenuItem | ||
{...props} | ||
sx={{ | ||
...(condition && highlightStyle), | ||
}} | ||
> | ||
{children} | ||
</MenuItem> | ||
); | ||
}; | ||
|
||
export function isCommitStringHighlight(commit:string,commits: any[],filenameFilter:string|undefined){ | ||
const matchedCommit = commits.find((c:any) => c.head_sha === commit); | ||
if (!matchedCommit) { | ||
return false; | ||
} | ||
return isCommitHighlight(filenameFilter,matchedCommit); | ||
} | ||
|
||
export function isCommitHighlight(filenameFilter: string | undefined, commit: any) { | ||
if (filenameFilter === undefined || filenameFilter == "all") { | ||
return false; | ||
} | ||
const found = commit.filenames.filter((f: string) => f.includes(filenameFilter)); | ||
return found.length > 0; | ||
} |
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