-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into dashboard-layout-…
…docs-improvements
- Loading branch information
Showing
177 changed files
with
5,808 additions
and
1,628 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 |
---|---|---|
|
@@ -16,3 +16,6 @@ build | |
|
||
.generated | ||
.github | ||
|
||
.coverage | ||
.tsup |
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
47 changes: 47 additions & 0 deletions
47
docs/data/toolpad/core/components/account/AccountCustom.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as React from 'react'; | ||
import { Account, AuthenticationContext, SessionContext } from '@toolpad/core'; | ||
|
||
export default function AccountCustom() { | ||
const [session, setSession] = React.useState(null); | ||
const authentication = React.useMemo(() => { | ||
return { | ||
signIn: () => { | ||
setSession({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
}, | ||
signOut: () => { | ||
setSession(null); | ||
}, | ||
}; | ||
}, []); | ||
|
||
return ( | ||
// preview-start | ||
<AuthenticationContext.Provider value={authentication}> | ||
<SessionContext.Provider value={session}> | ||
<Account | ||
slotProps={{ | ||
signInButton: { | ||
color: 'info', | ||
variant: 'outlined', | ||
sx: { | ||
color: 'primaryDark', | ||
fontFamily: 'Inter', | ||
fontSize: '1em', | ||
}, | ||
}, | ||
signOutButton: { color: 'primary', variant: 'outlined' }, | ||
}} | ||
signInLabel="Login" | ||
signOutLabel="Logout" | ||
/> | ||
</SessionContext.Provider> | ||
</AuthenticationContext.Provider> | ||
// preview-end | ||
); | ||
} |
52 changes: 52 additions & 0 deletions
52
docs/data/toolpad/core/components/account/AccountCustom.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as React from 'react'; | ||
import { | ||
Account, | ||
AuthenticationContext, | ||
SessionContext, | ||
Session, | ||
} from '@toolpad/core'; | ||
|
||
export default function AccountCustom() { | ||
const [session, setSession] = React.useState<Session | null>(null); | ||
const authentication = React.useMemo(() => { | ||
return { | ||
signIn: () => { | ||
setSession({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
}, | ||
signOut: () => { | ||
setSession(null); | ||
}, | ||
}; | ||
}, []); | ||
|
||
return ( | ||
// preview-start | ||
<AuthenticationContext.Provider value={authentication}> | ||
<SessionContext.Provider value={session}> | ||
<Account | ||
slotProps={{ | ||
signInButton: { | ||
color: 'info', | ||
variant: 'outlined', | ||
sx: { | ||
color: 'primaryDark', | ||
fontFamily: 'Inter', | ||
fontSize: '1em', | ||
}, | ||
}, | ||
signOutButton: { color: 'primary', variant: 'outlined' }, | ||
}} | ||
signInLabel="Login" | ||
signOutLabel="Logout" | ||
/> | ||
</SessionContext.Provider> | ||
</AuthenticationContext.Provider> | ||
// preview-end | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
docs/data/toolpad/core/components/account/AccountCustom.tsx.preview
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,20 @@ | ||
<AuthenticationContext.Provider value={authentication}> | ||
<SessionContext.Provider value={session}> | ||
<Account | ||
slotProps={{ | ||
signInButton: { | ||
color: 'info', | ||
variant: 'outlined', | ||
sx: { | ||
color: 'primaryDark', | ||
fontFamily: 'Inter', | ||
fontSize: '1em', | ||
}, | ||
}, | ||
signOutButton: { color: 'primary', variant: 'outlined' }, | ||
}} | ||
signInLabel="Login" | ||
signOutLabel="Logout" | ||
/> | ||
</SessionContext.Provider> | ||
</AuthenticationContext.Provider> |
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 @@ | ||
import * as React from 'react'; | ||
import { Account, AuthenticationContext, SessionContext } from '@toolpad/core'; | ||
|
||
export default function AccountDemo() { | ||
const [session, setSession] = React.useState(null); | ||
const authentication = React.useMemo(() => { | ||
return { | ||
signIn: () => { | ||
setSession({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
}, | ||
signOut: () => { | ||
setSession(null); | ||
}, | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<AuthenticationContext.Provider value={authentication}> | ||
<SessionContext.Provider value={session}> | ||
<Account /> | ||
</SessionContext.Provider> | ||
</AuthenticationContext.Provider> | ||
); | ||
} |
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,35 @@ | ||
import * as React from 'react'; | ||
import { | ||
Account, | ||
AuthenticationContext, | ||
SessionContext, | ||
Session, | ||
} from '@toolpad/core'; | ||
|
||
export default function AccountDemo() { | ||
const [session, setSession] = React.useState<Session | null>(null); | ||
const authentication = React.useMemo(() => { | ||
return { | ||
signIn: () => { | ||
setSession({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
}, | ||
signOut: () => { | ||
setSession(null); | ||
}, | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<AuthenticationContext.Provider value={authentication}> | ||
<SessionContext.Provider value={session}> | ||
<Account /> | ||
</SessionContext.Provider> | ||
</AuthenticationContext.Provider> | ||
); | ||
} |
5 changes: 5 additions & 0 deletions
5
docs/data/toolpad/core/components/account/AccountDemo.tsx.preview
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 @@ | ||
<AuthenticationContext.Provider value={authentication}> | ||
<SessionContext.Provider value={session}> | ||
<Account /> | ||
</SessionContext.Provider> | ||
</AuthenticationContext.Provider> |
37 changes: 37 additions & 0 deletions
37
docs/data/toolpad/core/components/account/AccountWithDashboard.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { AppProvider, DashboardLayout } from '@toolpad/core'; | ||
|
||
export default function AccountWithDashboard() { | ||
const [session, setSession] = React.useState({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
const authentication = React.useMemo(() => { | ||
return { | ||
signIn: () => { | ||
setSession({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
}, | ||
signOut: () => { | ||
setSession(null); | ||
}, | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<AppProvider session={session} authentication={authentication}> | ||
<DashboardLayout> | ||
<Box sx={{ px: 6, py: 2 }}>Dashboard content</Box> | ||
</DashboardLayout> | ||
</AppProvider> | ||
); | ||
} |
37 changes: 37 additions & 0 deletions
37
docs/data/toolpad/core/components/account/AccountWithDashboard.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import { Session, AppProvider, DashboardLayout } from '@toolpad/core'; | ||
|
||
export default function AccountWithDashboard() { | ||
const [session, setSession] = React.useState<Session | null>({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
const authentication = React.useMemo(() => { | ||
return { | ||
signIn: () => { | ||
setSession({ | ||
user: { | ||
name: 'Bharat Kashyap', | ||
email: 'bharatkashyap@outlook.com', | ||
image: 'https://avatars.githubusercontent.com/u/19550456', | ||
}, | ||
}); | ||
}, | ||
signOut: () => { | ||
setSession(null); | ||
}, | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<AppProvider session={session} authentication={authentication}> | ||
<DashboardLayout> | ||
<Box sx={{ px: 6, py: 2 }}>Dashboard content</Box> | ||
</DashboardLayout> | ||
</AppProvider> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
docs/data/toolpad/core/components/account/AccountWithDashboard.tsx.preview
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,3 @@ | ||
<DashboardLayout> | ||
<Box sx={{ px: 6, py: 2 }}>Dashboard content</Box> | ||
</DashboardLayout> |
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,29 @@ | ||
--- | ||
productId: toolpad-core | ||
title: Account | ||
components: Account | ||
--- | ||
|
||
# Account | ||
|
||
<p class="description">A component that renders an account management dropdown for your application.</p> | ||
|
||
The `Account` component is a quick and easy way to display an account management menu for authenticated users. It is deeply integrated with the `SignInPage` and `DashboardLayout` components, meaning that it automatically appears in the top navigation bar inside `DashboardLayout` once your users have signed in through the `SignInPage`. | ||
|
||
## States | ||
|
||
When signed out, the component renders as an inline sign in button within the dashboard layout. If a `session` object is present, the component is rendered as a dropdown containing the user's account details as well as an option to sign out. | ||
|
||
{{"demo": "AccountDemo.js", "bg": "gradient" }} | ||
|
||
## Customization | ||
|
||
### Components | ||
|
||
`Account` can take different labels for the sign in and sign out buttons through the `signInLabel` and `signOutLabel` props. Deeper changes can be made by passing in `slotProps` to the underlying components. | ||
|
||
{{"demo": "AccountCustom.js", "bg": "gradient" }} | ||
|
||
### 🚧 Composition | ||
|
||
The `Account` component allows adding your own menu options, including deeply nested options. This is in progress. |
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.
2 changes: 1 addition & 1 deletion
2
docs/data/toolpad/core/components/page-container/ActionsPageContainer.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
2 changes: 1 addition & 1 deletion
2
docs/data/toolpad/core/components/page-container/ActionsPageContainer.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
docs/data/toolpad/core/components/page-container/BasicPageContainer.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
2 changes: 1 addition & 1 deletion
2
docs/data/toolpad/core/components/page-container/BasicPageContainer.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.