generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 96
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 #85 from nebula-aac/custom-meshery-components
[components] created `searchbar` and `tooltip`
- Loading branch information
Showing
15 changed files
with
129 additions
and
13 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
2 changes: 1 addition & 1 deletion
2
packages/components/src/accordion.tsx → ...mponents/src/base/Accordion/accordion.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/components/src/accordionactions.tsx → ...s/src/base/Accordion/accordionactions.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/components/src/accordiondetails.tsx → ...s/src/base/Accordion/accordiondetails.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/components/src/accordionsummary.tsx → ...s/src/base/Accordion/accordionsummary.tsx
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,4 @@ | ||
export { Accordion } from './accordion'; | ||
export { AccordionActions } from './accordionactions'; | ||
export { AccordionDetails } from './accordiondetails'; | ||
export { AccordionSummary } from './accordionsummary'; |
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,52 @@ | ||
import React, { Fragment, type ChangeEvent, type FC, type ReactNode } from 'react'; | ||
import { Box } from '../box'; | ||
import { InputAdornment } from '../inputadornment'; | ||
import { TextField } from '../textfield'; | ||
|
||
interface SearchBarProps { | ||
onChange: (event: ChangeEvent<HTMLInputElement>) => void; | ||
value: string; | ||
width?: string; | ||
label: string; | ||
endAdornment?: ReactNode; | ||
} | ||
|
||
const SearchBar: FC<SearchBarProps> = ({ | ||
onChange, | ||
value, | ||
width, | ||
label, | ||
endAdornment, | ||
...props | ||
}) => { | ||
return ( | ||
<Fragment> | ||
<Box | ||
component="form" | ||
sx={{ | ||
'& > :not(style)': { width } | ||
}} | ||
{...props} | ||
> | ||
<TextField | ||
variant="outlined" | ||
label={label} | ||
fullWidth | ||
type="search" | ||
value={value} | ||
onChange={onChange} | ||
sx={{ | ||
margin: 'auto', | ||
height: '5ch' | ||
}} | ||
placeholder="Search" | ||
InputProps={{ | ||
endAdornment: <InputAdornment position="end">{endAdornment}</InputAdornment> | ||
}} | ||
/> | ||
</Box> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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,25 @@ | ||
import { type TooltipProps as MuiTooltipProps } from '@mui/material'; | ||
import React, { type FC, type MouseEvent, type ReactElement } from 'react'; | ||
import { Tooltip } from '../tooltip'; | ||
|
||
type TooltipProps = { | ||
title: string; | ||
onClick?: (event: MouseEvent<HTMLElement>) => void; | ||
children: ReactElement<any, any>; | ||
} & Omit<MuiTooltipProps, 'title' | 'children' | 'onClick'>; | ||
|
||
export const MesheryTooltip: FC<TooltipProps> = ({ | ||
title, | ||
onClick, | ||
placement, | ||
children, | ||
...props | ||
}) => { | ||
return ( | ||
<Tooltip title={title} placement={placement} onClick={onClick} arrow {...props}> | ||
{children} | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default Tooltip; |
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,2 @@ | ||
export { default as SearchBar } from './SearchBar'; | ||
export { default as Tooltip } from './Tooltip'; |
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,6 @@ | ||
import { InputAdornment as MuiInputAdornment, type InputAdornmentProps } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
export function InputAdornment(props: InputAdornmentProps): JSX.Element { | ||
return <MuiInputAdornment {...props} />; | ||
} |
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,6 +1,6 @@ | ||
import { TextField as MuiTextField, TextFieldProps } from '@mui/material'; | ||
import { TextField as MuiTextField, type TextFieldProps } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
export const TextField = (props: TextFieldProps) => { | ||
export function TextField(props: TextFieldProps): JSX.Element { | ||
return <MuiTextField {...props} />; | ||
}; | ||
} |
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,11 @@ | ||
import { MesherySearchBar } from '@layer5/sistent-components'; | ||
|
||
export default { | ||
title: 'Example/SearchBar', | ||
component: MesherySearchBar, | ||
tags: ['autodocs'] | ||
}; | ||
|
||
export function SearchBar() { | ||
return <MesherySearchBar />; | ||
} |
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,15 @@ | ||
import { BaseButton, MesheryTooltip } from '@layer5/sistent-components'; | ||
|
||
export default { | ||
title: 'Example/Tooltip', | ||
component: MesheryTooltip, | ||
tags: ['autodocs'] | ||
}; | ||
|
||
export function NonInteractiveTooltip() { | ||
return ( | ||
<MesheryTooltip title="Add" disableInteractive> | ||
<BaseButton>Not Interactive</BaseButton> | ||
</MesheryTooltip> | ||
); | ||
} |