Skip to content

Instantly share code, notes, and snippets.

@SibeeshVenu
Created October 19, 2018 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SibeeshVenu/85230b9bbae4c9b13d2eafb6aeda33a2 to your computer and use it in GitHub Desktop.
Save SibeeshVenu/85230b9bbae4c9b13d2eafb6aeda33a2 to your computer and use it in GitHub Desktop.
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-webpart-base';
import * as strings from 'MenuWebPartStrings';
import Menu from './components/Menu';
import { IMenuProps } from './components/IMenuProps';
export interface IMenuWebPartProps {
description: string;
}
export default class MenuWebPart extends BaseClientSideWebPart<IMenuWebPartProps> {
public render(): void {
const element: React.ReactElement<IMenuProps> = React.createElement(
Menu,
{
items: [
{ name: 'Home', url: '', key: 'key3' },
{ name: 'Admin', key: 'key4' }
]
}
);
ReactDom.render(element, this.domElement);
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment