Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

feat(license): add license component to display full license #598

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/pages/homepage/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {MatButtonModule} from '@angular/material/button';
import {FooterModule} from '../../shared/footer/footer';
import {RouterModule} from '@angular/router';
import {ComponentPageTitle} from '../page-title/page-title';
import { LicenseModule } from '../license/license';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the spaces surrounding the import.

Suggested change
import { LicenseModule } from '../license/license';
import {LicenseModule} from '../license/license';


@Component({
selector: 'app-homepage',
Expand All @@ -21,7 +22,7 @@ export class Homepage implements OnInit {
}

@NgModule({
imports: [SvgViewerModule, MatButtonModule, FooterModule, RouterModule],
imports: [SvgViewerModule, MatButtonModule, FooterModule, RouterModule, LicenseModule],
exports: [Homepage],
declarations: [Homepage],
})
Expand Down
21 changes: 21 additions & 0 deletions src/app/pages/license/license.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="license-content">
<p class="license-title">The MIT License</p>
<p>Copyright (c) 2010-2019 Google LLC. <a href="license">http://material.angular.io/license</a></p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a good idea to use routerLink here instead of a href tag

<p>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:</p>
<p>The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.</p>
<p>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.</p>
</div>

<app-footer></app-footer>
16 changes: 16 additions & 0 deletions src/app/pages/license/license.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import '../../../styles/constants';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be indented with 2 spaces instead of 4.


:host {
display: flex;
flex-direction: column;
flex-grow: 1;
}

.license-content {
flex-grow: 1;
margin: $content-padding-side;

@media (max-width: $small-breakpoint-width) {
margin: 0;
}
}
16 changes: 16 additions & 0 deletions src/app/pages/license/license.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Component, NgModule } from "@angular/core";
Copy link
Contributor

@EdricChan03 EdricChan03 May 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be indented with 2 spaces instead of 4 and use single quotes instead of double quotes as well as removing the spaces from your import statements.

import { FooterModule } from "../../shared/footer/footer";

@Component({
selector: 'app-license',
templateUrl: './license.html',
styleUrls: ['./license.scss']
})
export class License {}

@NgModule({
imports: [FooterModule],
exports: [License],
declarations: [License],
})
export class LicenseModule {}
2 changes: 2 additions & 0 deletions src/app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import {
CanActivateComponentSidenav
} from './pages/component-sidenav/component-sidenav-can-load-guard';
import {GuideViewer} from './pages/guide-viewer/guide-viewer';
import {License} from './pages/license/license';

export const MATERIAL_DOCS_ROUTES: Routes = [
{path: '', component: Homepage, pathMatch: 'full', data: {}},
{path: 'categories', redirectTo: '/components/categories'},
{path: 'license', component: License},
{path: 'guides', component: GuideList, data: {}},
// Since https://github.com/angular/components/pull/9574, the cdk-table guide became the overview
// document for the cdk table. To avoid any dead / broken links, we redirect to the new location.
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/footer/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<div class="docs-footer-copyright">
<span>Powered by Google ©2010-2019.</span>
<span>Code licensed under an MIT-style License.</span>
<span>Code licensed under an <a [routerLink]="['/license']" title="License text">MIT-style License</a>.</span>
<span>Documentation licensed under CC BY 4.0.</span>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/app/shared/footer/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
flex-direction: column;
min-width: 225px;
text-align: center;

a:any-link {
color: inherit;
}
}

.docs-footer-logo span {
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/footer/footer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {Component, NgModule} from '@angular/core';
import {materialVersion} from '../version/version';
import { RouterModule } from '@angular/router';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the spaces surrounding the import.

Suggested change
import { RouterModule } from '@angular/router';
import {RouterModule} from '@angular/router';

import { MATERIAL_DOCS_ROUTES } from '../../routes';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the spaces surrounding the import.

Suggested change
import { MATERIAL_DOCS_ROUTES } from '../../routes';
import {MATERIAL_DOCS_ROUTES} from '../../routes';


@Component({
selector: 'app-footer',
Expand All @@ -14,6 +16,7 @@ export class Footer {


@NgModule({
imports: [RouterModule.forRoot(MATERIAL_DOCS_ROUTES)],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use RouterModule#forChild instead of RouterModule#forRoot on submodules/lazy-loaded modules (as indicated in the API docs for RouterModule).

Suggested change
imports: [RouterModule.forRoot(MATERIAL_DOCS_ROUTES)],
imports: [RouterModule.forChild(MATERIAL_DOCS_ROUTES)],

exports: [Footer],
declarations: [Footer],
})
Expand Down