-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): allow passing global app name and app icon (#5993)
- Loading branch information
Showing
26 changed files
with
368 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
"@refinedev/core": minor | ||
--- | ||
|
||
feat(core): ability to pass global app title and icon | ||
|
||
Added ability to pass global app name and icon values through `<Refine />` component's `options` prop. | ||
|
||
Now `<Refine />` component accepts `options.title` prop that can be used to set app icon and app name globally. By default these values will be accessible through `useRefineOptions` hook and will be used in `<ThemedLayoutV2 />` and `<AuthPage />` components of the UI packages. | ||
|
||
```tsx | ||
import { Refine } from "@refinedev/core"; | ||
|
||
const MyIcon = () => <svg>{/* ... */}</svg>; | ||
|
||
const App = () => { | ||
return ( | ||
<Refine | ||
options={{ | ||
title: { | ||
icon: <MyIcon />, | ||
text: "Refine App", | ||
}, | ||
}} | ||
> | ||
{/* ... */} | ||
</Refine> | ||
); | ||
}; | ||
``` |
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,5 @@ | ||
--- | ||
"@refinedev/ui-tests": patch | ||
--- | ||
|
||
chore(ui-tests): add test case for globally passed app title and app icon to title tests |
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,7 @@ | ||
--- | ||
"@refinedev/ui-types": patch | ||
--- | ||
|
||
chore(ThemedTitleProps): update icon and text tsdoc descriptions | ||
|
||
Updated TSDoc descriptions of the `icon` and `text` props in the `RefineLayoutThemedTitleProps` interface to provide default values and how they are used in the component. |
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,33 @@ | ||
--- | ||
"@refinedev/chakra-ui": minor | ||
"@refinedev/mantine": minor | ||
"@refinedev/antd": minor | ||
"@refinedev/mui": minor | ||
--- | ||
|
||
feat: use global values by default for app title and app icon | ||
|
||
Now `<Refine />` component accepts `options.title` prop that can be used to set app icon and app name globally. For `<ThemedLayoutV2 />` and `<AuthPage />` components, these values will be used by default. While users can use `options.title` to pass global values for app icon and app name, option to override through `<ThemedTitleV2 />` component is still available for users to override these values in specific use cases. | ||
|
||
```tsx | ||
import { Refine } from "@refinedev/core"; | ||
|
||
const MyIcon = () => <svg>{/* ... */}</svg>; | ||
|
||
const App = () => { | ||
return ( | ||
<Refine | ||
options={{ | ||
title: { | ||
icon: <MyIcon />, | ||
text: "Refine App", | ||
}, | ||
}} | ||
> | ||
{/* ... */} | ||
</Refine> | ||
); | ||
}; | ||
``` | ||
|
||
Then, `<ThemedLayoutV2 />` and `<AuthPage />` components will display `<MyIcon />` and `"Refine App"` as app icon and app name respectively. |
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
11 changes: 0 additions & 11 deletions
11
examples/with-nextjs/src/components/themed-layout/index.tsx
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
packages/antd/src/components/themedLayoutV2/title/index.spec.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
42 changes: 15 additions & 27 deletions
42
packages/antd/src/components/themedLayoutV2/title/index.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 was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/chakra-ui/src/components/themedLayout/title/index.spec.ts
This file was deleted.
Oops, something went wrong.
42 changes: 15 additions & 27 deletions
42
packages/chakra-ui/src/components/themedLayoutV2/title/index.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
Oops, something went wrong.