Updated CSS

This commit is contained in:
Harsha Vardhini 2020-05-15 00:05:49 +05:30
parent bc878ece1d
commit 9cc24ef1dc
6 changed files with 39 additions and 57 deletions

View File

@ -9,9 +9,9 @@ node_modules
# Build generated files # Build generated files
dist dist
lib lib
solution #solution
temp temp
*.sppkg #*.sppkg
# Coverage directory used by tools like istanbul # Coverage directory used by tools like istanbul
coverage coverage

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -3,63 +3,32 @@
.saveEmailToSharePoint { .saveEmailToSharePoint {
.container { .container {
@include ms-Grid; @include ms-Grid;
max-width: 700px;
margin: 0px auto;
margin-left: 5px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
}
.errMsg {
@include ms-Grid-col;
margin-top: 5px !important;
} }
.errMsg,
.successMsg { .successMsg {
@include ms-Grid-col; @include ms-Grid-col;
margin-top: 5px !important; margin-top: 5px !important;
right: 2px;
} }
.iconStyle { .iconStyle {
@include ms-Grid-col; margin-right: 8px;
@include ms-sm1;
}
.labelStyle {
@include ms-Grid-col;
@include ms-sm4;
margin-top: -4px;
} }
.row { .row {
@include ms-Grid-row; margin-left: 5px;
@include ms-fontColor-white;
background-color: $ms-color-themeDark;
padding: 20px;
} }
.column { .column {
@include ms-Grid-col; @include ms-Grid-col;
padding-left: 0px;
@include ms-lg10; @include ms-lg10;
@include ms-xl8; @include ms-xl8;
@include ms-xlPush2; @include ms-xlPush2;
@include ms-lgPush1; @include ms-lgPush1;
} }
.title {
@include ms-font-xl;
@include ms-fontColor-white;
}
.subTitle {
@include ms-font-l;
@include ms-fontColor-white;
}
.description {
@include ms-font-l;
@include ms-fontColor-white;
}
.button { .button {
// Our button // Our button
text-decoration: none; text-decoration: none;
@ -105,4 +74,8 @@
margin-top: 5px; margin-top: 5px;
margin-left: 5px; margin-left: 5px;
} }
.ms-Dropdown-caretDownWrapper {
right: 16px;
}
} }

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import styles from './SaveEmailToSharePoint.module.scss'; import styles from './SaveEmailToSharePoint.module.scss';
import { ISaveEmailToSharePointProps } from './ISaveEmailToSharePointProps'; import { ISaveEmailToSharePointProps } from './ISaveEmailToSharePointProps';
import { SearchResults } from "@pnp/sp/search"; import { SearchResults } from "@pnp/sp/search";
import { Icon, Dropdown, IDropdownOption, IDropdownStyles, PrimaryButton, Label, IDropdownProps, Link, MessageBar, MessageBarType } from 'office-ui-fabric-react'; import { Icon, Dropdown, IDropdownOption, IDropdownStyles, PrimaryButton, Label, IDropdownProps, Link, MessageBar, MessageBarType, MessageBarButton } from 'office-ui-fabric-react';
import Services from './Services/Services'; import Services from './Services/Services';
import * as strings from 'SaveEmailToSharePointWebPartStrings'; import * as strings from 'SaveEmailToSharePointWebPartStrings';
@ -29,7 +29,7 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
savedLink: '', savedLink: '',
rootURL: '', rootURL: '',
errMsg: '' errMsg: ''
} };
} }
public componentWillMount() { public componentWillMount() {
this.getAllSites(); this.getAllSites();
@ -48,11 +48,13 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
this.services.saveFileToSP(this.state.selectedSite.key, this.state.selectedLibrary.key, filename, file).then((result) => { this.services.saveFileToSP(this.state.selectedSite.key, this.state.selectedLibrary.key, filename, file).then((result) => {
console.log(result.data.ServerRelativeUrl); console.log(result.data.ServerRelativeUrl);
this.setState({ this.setState({
savedLink: this.state.rootURL + result.data.ServerRelativeUrl + "?web=1" savedLink: this.state.rootURL + result.data.ServerRelativeUrl + "?web=1",
errMsg:''
}); });
}).catch((err) => { }).catch((err) => {
this.setState({ this.setState({
errMsg: err.message errMsg: this.parseErr(err.message),
savedLink:''
}); });
}); });
} }
@ -75,10 +77,14 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
this.saveToLibrary(response); this.saveToLibrary(response);
}).catch((err) => { }).catch((err) => {
this.setState({ this.setState({
errMsg: "Graph API error: " + err.message errMsg: "Graph API error: " + this.parseErr(err.message),
savedLink:''
}); });
}); });
} }
public parseErr(msg:string){
return JSON.parse(msg.substring(msg.indexOf('"message"')+10,msg.length-2)).value;
}
public OnSelectSite = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption) => { public OnSelectSite = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption) => {
this.services.getAllDocumentLibary(item.key.toString()).then((libraries) => { this.services.getAllDocumentLibary(item.key.toString()).then((libraries) => {
if (libraries.length) { if (libraries.length) {
@ -94,8 +100,8 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
} else { } else {
this.setState({ this.setState({
selectedSite: item, selectedSite: item,
savedLink:'', savedLink: '',
errMsg:'' errMsg: ''
}); });
} }
}); });
@ -109,7 +115,7 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
} }
public render(): React.ReactElement<ISaveEmailToSharePointProps> { public render(): React.ReactElement<ISaveEmailToSharePointProps> {
return ( return (
<div className={styles.container} > <div className={styles.saveEmailToSharePoint} >
<div className={styles.row}> <div className={styles.row}>
{this.state.allSites ? <Dropdown {this.state.allSites ? <Dropdown
label={strings.SiteLabel} label={strings.SiteLabel}
@ -150,24 +156,27 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
{this.state.savedLink.length ? {this.state.savedLink.length ?
<MessageBar <MessageBar
messageBarType={MessageBarType.success} messageBarType={MessageBarType.success}
isMultiline={false} isMultiline={true}
onDismiss={null} onDismiss={null}
className={styles.successMsg} className={styles.successMsg}
dismissButtonAriaLabel="Close"> dismissButtonAriaLabel="Close"
<Link href={this.state.savedLink} target='_blank' className="ms-fadeIn500"> actions={
{strings.PreviewMessage} <div>
</Link> <MessageBarButton onClick={()=>window.open(this.state.savedLink,'_blank')}>OK</MessageBarButton>
</div>
}>
{strings.PreviewMessage.replace("{libName}", this.state.selectedLibrary.text)}
</MessageBar> </MessageBar>
: null} : null}
{this.state.errMsg.length? <MessageBar {this.state.errMsg.length ? <MessageBar
messageBarType={MessageBarType.error} messageBarType={MessageBarType.error}
isMultiline={false} isMultiline={true}
onDismiss={null} onDismiss={null}
className={styles.errMsg} className={styles.errMsg}
dismissButtonAriaLabel="Close"> dismissButtonAriaLabel="Close">
{this.state.errMsg} {this.state.errMsg}
</MessageBar> </MessageBar>
:null} : null}
</div> </div>
</div> </div>
); );
@ -176,7 +185,7 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
return ( return (
<React.Fragment> <React.Fragment>
<Icon iconName="DocLibrary" className={styles.iconStyle} /> <Icon iconName="DocLibrary" className={styles.iconStyle} />
<Label className={styles.labelStyle}>{props.label}</Label> <span >{props.label}</span>
</React.Fragment> </React.Fragment>
); );
} }
@ -184,7 +193,7 @@ export default class SaveEmailToSharePoint extends React.Component<ISaveEmailToS
return ( return (
<React.Fragment> <React.Fragment>
<Icon iconName="Website" className={styles.iconStyle} /> <Icon iconName="Website" className={styles.iconStyle} />
<Label className={styles.labelStyle}>{props.label}</Label> <span >{props.label}</span>
</React.Fragment> </React.Fragment>
); );
} }

View File

@ -7,7 +7,7 @@ define([], function () {
"SitePlaceHolder": "Select a site", "SitePlaceHolder": "Select a site",
"LibraryLabel": "Select a Library", "LibraryLabel": "Select a Library",
"LibraryPlaceHolder": "Select a Library", "LibraryPlaceHolder": "Select a Library",
"PreviewMessage":"Select to preview the saved email", "PreviewMessage":"The selected email is saved in the {libName} Library. Select 'OK' to preview the saved email.",
"Save": "Save", "Save": "Save",
"Cancel": "Cancel" "Cancel": "Cancel"
} }