-
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 #9 from osstotalsoft/feature/Rename
rename directory
- Loading branch information
Showing
376 changed files
with
14,076 additions
and
14,076 deletions.
There are no files selected for viewing
File renamed without changes.
54 changes: 27 additions & 27 deletions
54
...tons/back-to-button/BackToButton.docs.mdx → ...tons/back-to-button/BackToButton.docs.mdx
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,27 +1,27 @@ | ||
--- | ||
description: 'BackToButton component.' | ||
labels: ['mui', 'react', 'back-to-button'] | ||
--- | ||
|
||
import BackToButton from './BackToButton' | ||
import { BrowserRouter } from 'react-router-dom' | ||
|
||
## Basic BackToButton component | ||
|
||
Basic example that renders an back-to-button | ||
|
||
### Component usage | ||
|
||
```js | ||
<BackToButton size='small' tooltip='small' /> | ||
``` | ||
|
||
### Use this live example to interact with BackToButton component | ||
|
||
Live example: | ||
|
||
```js live | ||
<BrowserRouter> | ||
<BackToButton size='small' tooltip='small' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
``` | ||
--- | ||
description: 'BackToButton component.' | ||
labels: ['mui', 'react', 'back-to-button'] | ||
--- | ||
|
||
import BackToButton from './BackToButton' | ||
import { BrowserRouter } from 'react-router-dom' | ||
|
||
## Basic BackToButton component | ||
|
||
Basic example that renders an back-to-button | ||
|
||
### Component usage | ||
|
||
```js | ||
<BackToButton size='small' tooltip='small' /> | ||
``` | ||
|
||
### Use this live example to interact with BackToButton component | ||
|
||
Live example: | ||
|
||
```js live | ||
<BrowserRouter> | ||
<BackToButton size='small' tooltip='small' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
``` |
76 changes: 38 additions & 38 deletions
76
...ts/buttons/back-to-button/BackToButton.js → ...ts/buttons/back-to-button/BackToButton.js
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,38 +1,38 @@ | ||
import React, { useCallback } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { useNavigate } from 'react-router-dom' | ||
import ArrowBackIcon from '@mui/icons-material/ArrowBack' | ||
import IconButton from '@totalsoft_oss/rocket-ui.components.buttons.icon-button' | ||
|
||
const BackToButton = ({ path, fontSize = 'small', size = 'medium', ...rest }) => { | ||
const navigate = useNavigate() | ||
|
||
const onBackToList = useCallback(() => { | ||
path && navigate(path) | ||
}, [history, path]) | ||
|
||
return ( | ||
<IconButton aria-label='back' onClick={onBackToList} size={size} {...rest}> | ||
<ArrowBackIcon fontSize={fontSize} /> | ||
</IconButton> | ||
) | ||
} | ||
|
||
BackToButton.propTypes = { | ||
/** | ||
* @default 'medium' | ||
* Size of the button | ||
*/ | ||
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large']), | ||
/** | ||
* @default 'small' | ||
* Size of the icon. | ||
*/ | ||
fontSize: PropTypes.oneOf(['inherit', 'small', 'medium', 'large']), | ||
/** | ||
* Path where browser will be directed to when the button is clicked. | ||
*/ | ||
path: PropTypes.string | ||
} | ||
|
||
export default BackToButton | ||
import React, { useCallback } from 'react' | ||
import PropTypes from 'prop-types' | ||
import { useNavigate } from 'react-router-dom' | ||
import ArrowBackIcon from '@mui/icons-material/ArrowBack' | ||
import IconButton from '@totalsoft_oss/rocket-ui.components.buttons.icon-button' | ||
|
||
const BackToButton = ({ path, fontSize = 'small', size = 'medium', ...rest }) => { | ||
const navigate = useNavigate() | ||
|
||
const onBackToList = useCallback(() => { | ||
path && navigate(path) | ||
}, [history, path]) | ||
|
||
return ( | ||
<IconButton aria-label='back' onClick={onBackToList} size={size} {...rest}> | ||
<ArrowBackIcon fontSize={fontSize} /> | ||
</IconButton> | ||
) | ||
} | ||
|
||
BackToButton.propTypes = { | ||
/** | ||
* @default 'medium' | ||
* Size of the button | ||
*/ | ||
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large']), | ||
/** | ||
* @default 'small' | ||
* Size of the icon. | ||
*/ | ||
fontSize: PropTypes.oneOf(['inherit', 'small', 'medium', 'large']), | ||
/** | ||
* Path where browser will be directed to when the button is clicked. | ||
*/ | ||
path: PropTypes.string | ||
} | ||
|
||
export default BackToButton |
48 changes: 24 additions & 24 deletions
48
...ttons/back-to-button/BackToButton.test.js → ...ttons/back-to-button/BackToButton.test.js
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,24 +1,24 @@ | ||
import React from 'react' | ||
import BackToButton from './BackToButton' | ||
import { screen, waitFor } from '@testing-library/react' | ||
import { BrowserRouter, Routes, Route } from 'react-router-dom' | ||
import fns from '@totalsoft_oss/rocket-ui.utils.test-wrapper' | ||
|
||
const { render, userClick } = fns | ||
|
||
describe('BackToButton', () => { | ||
test('redirects to the path received', async () => { | ||
render( | ||
<BrowserRouter> | ||
<BackToButton path='/back' /> | ||
<Routes> | ||
<Route path='/back' element={<div>{'redirected'}</div>}></Route> | ||
</Routes> | ||
</BrowserRouter> | ||
) | ||
userClick(screen.getByRole('button')) | ||
await waitFor(() => { | ||
expect(screen.getByText('redirected')).toBeInTheDocument() | ||
}) | ||
}) | ||
}) | ||
import React from 'react' | ||
import BackToButton from './BackToButton' | ||
import { screen, waitFor } from '@testing-library/react' | ||
import { BrowserRouter, Routes, Route } from 'react-router-dom' | ||
import fns from '@totalsoft_oss/rocket-ui.utils.test-wrapper' | ||
|
||
const { render, userClick } = fns | ||
|
||
describe('BackToButton', () => { | ||
test('redirects to the path received', async () => { | ||
render( | ||
<BrowserRouter> | ||
<BackToButton path='/back' /> | ||
<Routes> | ||
<Route path='/back' element={<div>{'redirected'}</div>}></Route> | ||
</Routes> | ||
</BrowserRouter> | ||
) | ||
userClick(screen.getByRole('button')) | ||
await waitFor(() => { | ||
expect(screen.getByText('redirected')).toBeInTheDocument() | ||
}) | ||
}) | ||
}) |
70 changes: 35 additions & 35 deletions
70
.../compositions/BackToButton.composition.js → .../compositions/BackToButton.composition.js
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,35 +1,35 @@ | ||
import React from 'react' | ||
import Grid from '@mui/material/Grid' | ||
import BackToButton from '../BackToButton' | ||
import CollapseCard from '@totalsoft_oss/rocket-ui.components.surfaces.collapse-card' | ||
import { BrowserRouter } from 'react-router-dom' | ||
|
||
export const BasicBackToButton = () => { | ||
return ( | ||
<CollapseCard | ||
defaultExpanded | ||
title='Back-to Button' | ||
content={ | ||
<Grid container> | ||
<Grid item xs={12} container spacing={3}> | ||
<Grid item> | ||
<BrowserRouter> | ||
<BackToButton size='small' tooltip='small' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
</Grid> | ||
<Grid item> | ||
<BrowserRouter> | ||
<BackToButton size='medium' tooltip='medium' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
</Grid> | ||
<Grid item> | ||
<BrowserRouter> | ||
<BackToButton size='large' tooltip='large (default)' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
} | ||
/> | ||
) | ||
} | ||
import React from 'react' | ||
import Grid from '@mui/material/Grid' | ||
import BackToButton from '../BackToButton' | ||
import CollapseCard from '@totalsoft_oss/rocket-ui.components.surfaces.collapse-card' | ||
import { BrowserRouter } from 'react-router-dom' | ||
|
||
export const BasicBackToButton = () => { | ||
return ( | ||
<CollapseCard | ||
defaultExpanded | ||
title='Back-to Button' | ||
content={ | ||
<Grid container> | ||
<Grid item xs={12} container spacing={3}> | ||
<Grid item> | ||
<BrowserRouter> | ||
<BackToButton size='small' tooltip='small' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
</Grid> | ||
<Grid item> | ||
<BrowserRouter> | ||
<BackToButton size='medium' tooltip='medium' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
</Grid> | ||
<Grid item> | ||
<BrowserRouter> | ||
<BackToButton size='large' tooltip='large (default)' path='https://bit.cloud/totalsoft_oss/rocket-ui' /> | ||
</BrowserRouter> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
} | ||
/> | ||
) | ||
} |
2 changes: 1 addition & 1 deletion
2
...ponents/buttons/back-to-button/index.d.ts → ...ponents/buttons/back-to-button/index.d.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,2 +1,2 @@ | ||
export { default } from './BackToButton'; | ||
export { default } from './BackToButton'; | ||
export * from './BackToButton'; |
4 changes: 2 additions & 2 deletions
4
...omponents/buttons/back-to-button/index.js → ...omponents/buttons/back-to-button/index.js
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,2 +1,2 @@ | ||
import BackToButton from './BackToButton' | ||
export default BackToButton | ||
import BackToButton from './BackToButton' | ||
export default BackToButton |
File renamed without changes.
Oops, something went wrong.