-
Notifications
You must be signed in to change notification settings - Fork 224
support modern header footer #1691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
0c726d0
a8459e8
a17df6f
5b15570
52ee035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace PnP.Core.Model.SharePoint | ||
| { | ||
| internal sealed class FontOption : IFontOption | ||
| { | ||
| /// <summary> | ||
| /// fontFamilyKey | ||
| /// </summary> | ||
| [JsonPropertyName("fontFamilyKey")] | ||
| public string FamilyKey { get; set; } | ||
| /// <summary> | ||
| /// fontFace | ||
| /// </summary> | ||
| [JsonPropertyName("fontFace")] | ||
| public string Face { get; set; } | ||
| /// <summary> | ||
| /// fontVariantWeight | ||
| /// </summary> | ||
| [JsonPropertyName("fontVariantWeight")] | ||
| public string VariantWeight { get; set; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace PnP.Core.Model.SharePoint | ||
| { | ||
| internal sealed class FontOptions : IFontOptions | ||
| { | ||
| public IFontOption SiteTitle { get; set; } = null; | ||
| public IFontOption SiteNav { get; set; } = null; | ||
| public IFontOption SiteFooterTitle { get; set; } = null; | ||
| public IFontOption SiteFooterNav { get; set; } = null; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace PnP.Core.Model.SharePoint | ||
| { | ||
| internal sealed class FontPackage : IFontPackage | ||
| { | ||
| public string ID { get; set; } | ||
| public bool IsHidden { get; set; } | ||
| public bool IsValid { get; set; } | ||
| public string PackageJson { get; set; } | ||
| public int Store { get; set; } | ||
| public string Title { get; set; } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,11 @@ internal HeaderOptions(PnPContext pnpContext) | |
| public bool HideTitle { get; set; } | ||
|
|
||
| public LogoAlignment LogoAlignment { get; set; } | ||
| public OverlayColorType OverlayColor { get; set; } = OverlayColorType.None; | ||
| public int OverlayOpacity { get; set; } = 0; | ||
| public OverlayGradientDirectionType OverlayGradientDirection { get; set; } = OverlayGradientDirectionType.TopToBottom; | ||
| public int ColorIndexInLightMode { get; set; } = -1; | ||
| public int ColorIndexInDarkMode { get; set; } = -1; | ||
|
|
||
| public async Task SetSiteLogoAsync(string fileName, Stream content, bool overwrite = false) | ||
| { | ||
|
|
@@ -145,10 +150,11 @@ public void ResetSiteLogoThumbnail() | |
|
|
||
| public async Task SetHeaderBackgroundImageAsync(string fileName, Stream content, double focalX = 0, double focalY = 0, bool overwrite = false) | ||
| { | ||
| if (Layout != HeaderLayoutType.Extended) | ||
| { | ||
| throw new ClientException(ErrorType.Unsupported, PnPCoreResources.Exception_Unsupported_BackgroundImageHeaderIsNotOfTypeExtended); | ||
| } | ||
| // => modern Header does allow background images for all layouts | ||
| //if (Layout != HeaderLayoutType.Extended) | ||
| //{ | ||
| // throw new ClientException(ErrorType.Unsupported, PnPCoreResources.Exception_Unsupported_BackgroundImageHeaderIsNotOfTypeExtended); | ||
| //} | ||
|
Comment on lines
+153
to
+157
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a valid comment. Was it commented out by mistake? If it is not needed we should just remove it |
||
|
|
||
| // Upload the image | ||
| IFile siteLogo = await UploadImageToSiteAssetsAsync(fileName, content, overwrite).ConfigureAwait(false); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| using System.Text.Json.Serialization; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace PnP.Core.Model.SharePoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// specify font to use for header / footer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public interface IFontOption | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// fontFamilyKey | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [JsonPropertyName("fontFamilyKey")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string FamilyKey { get; set; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// fontFace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [JsonPropertyName("fontFace")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string Face { get; set; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// fontVariantWeight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [JsonPropertyName("fontVariantWeight")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string VariantWeight { get; set; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+27
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the attributes for the System.Text.Json should only be set on the class. Since there are already present in the
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| namespace PnP.Core.Model.SharePoint | ||
| { | ||
| /// <summary> | ||
| /// Options to configure a the site font chrome. | ||
| /// </summary> | ||
| public interface IFontOptions | ||
| { | ||
| /// <summary> | ||
| /// fontOptionForSiteTitle | ||
| /// </summary> | ||
| IFontOption SiteTitle { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// fontOptionForSiteNav | ||
| /// </summary> | ||
| IFontOption SiteNav { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// fontOptionForSiteFooterTitle | ||
| /// </summary> | ||
| IFontOption SiteFooterTitle { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// fontOptionForSiteFooterNav | ||
| /// </summary> | ||
| IFontOption SiteFooterNav { get; set; } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We extend the public API surface and we add zero new test cases in the BrandingTests.cs, lets try to align with the current approach, and at minimum, lets please add tests for GetOutOfBoxFontPackages, GetFontPackages, SetOutOfBoxFontPackage,