File tree Expand file tree Collapse file tree 3 files changed +37
-10
lines changed
react-static-web-apps-auth Expand file tree Collapse file tree 3 files changed +37
-10
lines changed Original file line number Diff line number Diff line change 11# Changelog for ` react-static-web-apps-auth `
22
3+ ## [ 1.7.1] - 2024-03-26
4+
5+ ## Added
6+
7+ - Custom render function support for User Purge component
8+
39## [ 1.7.0] - 2024-03-26
410
511### Added
Original file line number Diff line number Diff line change 11{
22 "name" : " @aaronpowell/react-static-web-apps-auth" ,
3- "version" : " 1.7.0 " ,
3+ "version" : " 1.7.1 " ,
44 "description" : " A library to help creating authenticated React apps on Azure Static Web Apps" ,
55 "main" : " build/index.js" ,
66 "types" : " build/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -2,29 +2,50 @@ import React from "react";
22import { StaticWebAppsClassName } from "./constants" ;
33import { AuthProviders } from "./types" ;
44
5+ type UserPurgeRenderProps = {
6+ label : string ;
7+ href : string ;
8+ className : string ;
9+ } ;
10+
511const UserPurge = ( {
612 globally,
713 provider,
8- label
14+ label,
15+ customRenderer,
916} : {
1017 globally : boolean ;
1118 provider : AuthProviders ;
12- label ?: string
19+ label ?: string ;
20+ customRenderer ?: ( props : UserPurgeRenderProps ) => JSX . Element ;
1321} ) => {
1422 const host = globally ? "identity.azurestaticapps.net" : location . hostname ;
23+ const href = `https://${ host } /.auth/purge/${ provider } ` ;
24+ const className = `purge ${ StaticWebAppsClassName } ` ;
1525
16- return (
17- < a
18- href = { `https://${ host } /.auth/purge/${ provider } ` }
19- className = { `purge ${ StaticWebAppsClassName } ` }
20- >
21- { label ?? "Purge user information" }
22- </ a >
26+ return customRenderer ? (
27+ customRenderer ( {
28+ href,
29+ className,
30+ label : label ?? "Purge user information" ,
31+ } )
32+ ) : (
33+ < DefaultRenderer
34+ href = { href }
35+ className = { className }
36+ label = { label ?? "Purge user information" }
37+ />
2338 ) ;
2439} ;
2540
2641UserPurge . defaultProps = {
2742 globally : false ,
2843} ;
2944
45+ const DefaultRenderer = ( props : UserPurgeRenderProps ) => (
46+ < a href = { props . href } className = { props . className } >
47+ { props . label }
48+ </ a >
49+ ) ;
50+
3051export { UserPurge } ;
You can’t perform that action at this time.
0 commit comments