Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrobaktruhlik committed Mar 8, 2023
0 parents commit 4c23374
Show file tree
Hide file tree
Showing 33 changed files with 821 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules

# Build generated files
dist
lib
release
solution
temp
*.sppkg

# Coverage directory used by tools like istanbul
coverage

# OSX
.DS_Store

# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj

# Resx Generated Code
*.resx.ts

# Styles Generated Code
*.scss.ts

package-lock.json

# Sensitive data
.env
*.scss.d.ts
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!dist
config

gulpfile.js

release
src
temp

tsconfig.json
tslint.json

*.log

.yo-rc.json
.vscode
42 changes: 42 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "SPFx",
"type": "msedge",
"request": "launch",

// You have to create '.env' file with key: 'URL=https://your-sharepoint-site'
"url": "${input:envfile.url}/_layouts/workbench.aspx",

"webRoot": "${workspaceRoot}",
"sourceMaps": true,
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
"sourceMapPathOverrides": {
"webpack:///.././src/*": "${webRoot}/src/*",
"webpack:///../../../src/*": "${webRoot}/src/*",
"webpack:///../../../../src/*": "${webRoot}/src/*",
"webpack:///../../../../../src/*": "${webRoot}/src/*"
},
"runtimeArgs": [
"--remote-debugging-port=9222",
"-incognito"
]
}
],
"inputs": [
{
"id": "envfile.url",
"type": "command",
"command": "extension.commandvariable.file.content",
"args": {
"fileName": "${workspaceFolder}/.env",
"key": "URL",
"default": "https://enter-your-SharePoint-site"
}
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Place your settings in this file to overwrite default and user settings.
{
// Configure glob patterns for excluding files and folders in the file explorer.
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/bower_components": true,
"**/coverage": true,
"**/lib-amd": true,
"src/**/*.scss.ts": true
},
"typescript.tsdk": ".\\node_modules\\typescript\\lib",
"files.associations": {
"**/src/webparts/**/*.manifest.json": "jsonc"
}
}
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "serve",
"problemMatcher": [],
"label": "npm: serve",
"detail": "gulp bundle --custom-serve --max_old_space_size=4096 && fast-serve"
}
]
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Change Log

All notable changes to the `spfx-banner` extension.

## [Unreleased]
- Nothing


## [1.0.0] - 2023-03-08
First public release.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 chrobaktruhlik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Banner Web Part
Inspired by react-banner from [SharePoint Starter Kit](https://github.com/pnp/sp-starter-kit.git).

This web part provides the ability to add a variable height image banner with a title and link. Supported in SharePoint Online (Modern pages).

Uses [Image Helper API](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/image-helper-api). This allows for customers to store high-resolution images in SharePoint but not pay the download time penalty when those images are used.

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
![drop](https://img.shields.io/badge/Version-1.0.0-green.svg)

For more information see [CHANGELOG](CHANGELOG.md) file.

![Bannner](sharepoint/assets/screenshot1.jpg)

## Properties

The `Banner` webpart can be configured with the following properties:

| Title | Type | Description |
| ---- | ---- | ---- |
| Image URL | string | The url of the banner image. Supports files from sharing links or relative/absolute urls. |
| Label | string | The text message or title you want displayed on the banner image. (Max. two lines.) |
| Banner height | number | Provides the fixed height in px of the banner image. (Default: 200px) |
| Link URL | string | The banner hyperlink.|

## Install package to SharePoint:
- Add `spfx-banner.sppkg` to SharePoint AppCatalog and deploy
- Add the web part `Banner` to a SharePoint page and enjoy
- Configure the web part to update its properties.

## Disclaimer
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## License
Licensed under the [MIT](LICENSE.md) License.

## Minimal Path to Awesome

- Download this repository
- Install development toolchain prerequisites<br><span style="font-style:italic;">The SharePoint Framework development and build toolchain leverages various popular open-source tools. While most dependencies are included in project, you need to install a few dependencies globally on your workstation.</span>

- Install Gulp: `npm install gulp-cli --global`
- Install Yeoman: `npm install yo --global`<br><span style="font-style:italic;">Important: Yeoman v4.x is required by the SPFx v1.13 forward.</span>
- In the command line (in a package directory) run:
- Install the dependencies to the local node_modules folder: `npm install`
- Create the solution package (sppkg file) in sharepoint\solution folder: `npm run dist`

Binary file added assets/section.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/section36x36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"banner-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/banner/BannerWebPart.js",
"manifest": "./src/webparts/banner/BannerWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"BannerWebPartStrings": "lib/webparts/banner/loc/{locale}.js",
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js",
"PropertyControlStrings": "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js"
}
}
7 changes: 7 additions & 0 deletions config/deploy-azure-storage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "spfx-banner",
"accessKey": "<!-- ACCESS KEY -->"
}
51 changes: 51 additions & 0 deletions config/package-solution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "spfx-banner",
"id": "2be3aa32-6aa9-40de-bc1c-62829f9a0ba9",
"iconPath": "assets/section96x96.png",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.14.0"
},
"supportedLocales": [
"en-us",
"sk-sk"
],
"metadata": {
"shortDescription": {
"default": "spfx-banner short description",
"sk-sk": "Krátky opis aplikácie."
},
"longDescription": {
"default": "This web part provides the ability to add a variable height image banner with a title and link.",
"sk-sk": "Táto webová časť poskytuje možnosť pridať obrázkový banner s premenlivou výškou s názvom a prepojením."
},
"screenshotPaths": [
"assets/screenshot1.jpg"
],
"videoUrl": "",
"categories": [
"Site Design"
]
},
"features": [
{
"title": "spfx-banner Feature",
"description": "The feature that activates elements of the spfx-banner solution.",
"id": "b52cdefc-5b9e-4358-9ab0-ece526bb7d58",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/spfx-banner.sppkg"
}
}
6 changes: 6 additions & 0 deletions config/serve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx"
}
4 changes: 4 additions & 0 deletions config/write-manifests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}
6 changes: 6 additions & 0 deletions fast-serve/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/s-KaiNet/spfx-fast-serve/master/schema/config.latest.schema.json",
"cli": {
"isLibraryComponent": false
}
}
24 changes: 24 additions & 0 deletions fast-serve/webpack.extend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* User webpack settings file. You can add your own settings here.
* Changes from this file will be merged into the base webpack configuration file.
* This file will not be overwritten by the subsequent spfx-fast-serve calls.
*/

// you can add your project related webpack configuration here, it will be merged using webpack-merge module
// i.e. plugins: [new webpack.Plugin()]
const webpackConfig = {

}

// for even more fine-grained control, you can apply custom webpack settings using below function
const transformConfig = function (initialWebpackConfig) {
// transform the initial webpack config here, i.e.
// initialWebpackConfig.plugins.push(new webpack.Plugin()); etc.

return initialWebpackConfig;
}

module.exports = {
webpackConfig,
transformConfig
}
Loading

0 comments on commit 4c23374

Please sign in to comment.