[ADF-3874] icon component (#4112)

* adf-icon component

* demo shell example page

* add docs

* integration with thumbnail service
This commit is contained in:
Denys Vuika
2019-01-08 15:08:06 +00:00
committed by Eugenio Romano
parent 96e16fb046
commit 7dde329d81
16 changed files with 370 additions and 3 deletions

View File

@@ -314,6 +314,10 @@ export const appRoutes: Routes = [
path: 'about',
loadChildren: 'app/components/about/about.module#AppAboutModule'
},
{
path: 'icons',
loadChildren: './components/icons/icons.module#AppIconsModule'
},
{ path: 'form', component: FormComponent },
{ path: 'form-list', component: FormListComponent },
{ path: 'form-loading', component: FormLoadingComponent },

View File

@@ -59,6 +59,7 @@ export class AppLayoutComponent implements OnInit {
/* cspell:disable-next-line */
{ href: '/overlay-viewer', icon: 'pageview', title: 'APP_LAYOUT.OVERLAY_VIEWER' },
{ href: '/treeview', icon: 'nature', title: 'APP_LAYOUT.TREE_VIEW' },
{ href: '/icons', icon: 'tag_faces', title: 'APP_LAYOUT.ICONS' },
{ href: '/about', icon: 'info_outline', title: 'APP_LAYOUT.ABOUT' }
];

View File

@@ -0,0 +1,59 @@
<h1>Icons</h1>
<h2>Ligatures</h2>
<small>
See more details here:
<a href="https://material.angular.io/components/icon/overview#font-icons-with-ligatures">Font icons with ligatures</a>
</small>
<div>
<div><strong>Markup:</strong></div>
<pre>
&lt;adf-icon value="alarm"&gt;&lt;/adf-icon&gt;</pre>
</div>
<div>
<div><strong>Result:</strong></div>
<adf-icon value="alarm"></adf-icon>
</div>
<h2>Named icons</h2>
<small>
See more details here:
<a href="https://material.angular.io/components/icon/overview#named-icons">Named icons</a>
</small>
<div>
<div><strong>Code:</strong></div>
<pre>
matIconRegistry.addSvgIconInNamespace(
'adf',
'move_file',
this.sanitizer.bypassSecurityTrustResourceUrl(
'./assets/images/adf-move-file-24px.svg'
)
);</pre>
</div>
<div>
<div><strong>Markup:</strong></div>
<pre>
&lt;adf-icon value="adf:move_file"&gt;&lt;/adf-icon&gt;</pre>
</div>
<div>
<div><strong>Result:</strong></div>
<adf-icon value="adf:move_file"></adf-icon>
</div>
<h2>ADF Thumbnail Service</h2>
<div>
<div><strong>Markup:</strong></div>
<pre>
&lt;adf-icon value="image/gif"&gt;&lt;/adf-icon&gt;</pre>
</div>
<div>
<div><strong>Result:</strong></div>
<adf-icon value="image/gif"></adf-icon>
</div>

View File

@@ -0,0 +1,41 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, OnInit } from '@angular/core';
import { MatIconRegistry } from '@angular/material';
import { DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-icons-demo',
templateUrl: './icons.component.html'
})
export class IconsComponent implements OnInit {
constructor(
private matIconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer
) {}
ngOnInit() {
this.matIconRegistry.addSvgIconInNamespace(
'adf',
'move_file',
this.sanitizer.bypassSecurityTrustResourceUrl(
'./assets/images/adf-move-file-24px.svg'
)
);
}
}

View File

@@ -0,0 +1,39 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { IconsComponent } from './icons.component';
const routes: Routes = [
{
path: '',
component: IconsComponent
}
];
@NgModule({
imports: [
CommonModule,
CoreModule.forChild(),
RouterModule.forChild(routes)
],
declarations: [IconsComponent]
})
export class AppIconsModule {}

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><g id="Artboard_1"><g id="Page_1"><rect id="Fill_1" x="0" y="0" width="24" height="24" style="fill:none;"/><path id="Fill_2" d="M20,20l-16,0c-1.097,0 -2,-0.903 -2,-2l0.01,-12c0,-1.093 0.897,-1.995 1.99,-2l6,0l2,2l8,0c1.097,0 2,0.903 2,2l0,10c0,1.097 -0.903,2 -2,2Zm-9,-9l0,4l4,0l0,2l4,-4l-4,-4l0,2l-4,0Z" style="fill-rule:nonzero;"/></g></g></svg>

After

Width:  |  Height:  |  Size: 794 B