Skip to content

Commit 8dd1550

Browse files
Merge branch 'joaojmendes-LivePersona_Refractoring' into dev
2 parents 44e1bea + 8a05549 commit 8dd1550

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

docs/documentation/docs/controls/LivePersona.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { LivePersona } from "@pnp/spfx-controls-react/lib/LivePersona";
3535
<Persona text="João Mendes" secondaryText="[email protected]" coinSize={48} />
3636
</>
3737
}
38-
context={this.props.context}
38+
serviceScope={this.context.serviceScope}
3939
/>
4040
```
4141

@@ -47,7 +47,7 @@ The `LivePersona` control can be configured with the following properties:
4747

4848
| Property | Type | Required | Description |
4949
| ---- | ---- | ---- | ---- |
50-
| context | BaseComponentContext | yes | The context object of the SPFx loaded webpart or customizer. |
50+
| serviceScope | ServiceScope | yes | The SPFx ServiceScope object loaded from context of web part or extension. |
5151
| upn |string | yes | User UPN. |
5252
| disableHover | boolean | no | If info should not appear on hover. |
53-
| template | string \| JSX.ELement | yes | The content to wrap with persona info. |
53+
| template | string | JSX.ELement | yes | The content to wrap with persona info. |

src/controls/LivePersona/ILivePersonaProps.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import { BaseComponentContext} from "@microsoft/sp-component-base";
21
import { ServiceScope } from "@microsoft/sp-core-library";
32

43
export interface ILivePersonatProps {
5-
/**
6-
* The Web Part context
7-
*/
8-
context?: BaseComponentContext;
4+
95
/**
10-
* The Web Part context
6+
* The service locator pattern used by the SharePoint Framework.
117
*/
128
serviceScope: ServiceScope;
139
/**

src/controls/LivePersona/LivePersona.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const LivePersona: React.FunctionComponent<ILivePersonatProps> = (
1313
) => {
1414
const [isComponentLoaded, setIsComponentLoaded] = useState<boolean>(false);
1515
const sharedLibrary = useRef<any>();
16-
const { upn, template, disableHover, context, serviceScope } = props;
16+
const { upn, template, disableHover, serviceScope } = props;
1717

1818
useEffect(() => {
1919
(async () => {
@@ -22,7 +22,7 @@ export const LivePersona: React.FunctionComponent<ILivePersonatProps> = (
2222
sharedLibrary.current = await SPComponentLoader.loadComponentById(LIVE_PERSONA_COMPONENT_ID);
2323
setIsComponentLoaded(true);
2424
} catch (error) {
25-
Log.error(`[LivePersona]`, error, serviceScope ?? context.serviceScope);
25+
Log.error(`[LivePersona]`, error, serviceScope );
2626
}
2727
}
2828
})();
@@ -38,7 +38,7 @@ if (isComponentLoaded) {
3838
PersonaType: 'User'
3939
},
4040
upn: upn,
41-
serviceScope: serviceScope ?? context.serviceScope,
41+
serviceScope: serviceScope,
4242
}, createElement("div",{},template));
4343
}
4444
return renderPersona;

0 commit comments

Comments
 (0)