Skip to content

docs(examples/cdk/overlay): add a simple overlay example #19419

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

Merged
merged 21 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cb55f3c
doc(examples/cdk/overlay): add a basic component
andy9775 May 21, 2020
78978a5
build(examples/cdk/overlay): add bazel build config for overlay example
andy9775 May 21, 2020
50f3c6c
build(examples/cdk/overlay): update root examples bazel build script
andy9775 May 21, 2020
79e0bf3
docs(examples/cdk/overlay): add overlay example component to dev-app
andy9775 May 21, 2020
08ce2cd
build(examples/cdk/overlay): add bazel build script for overlay dev-app
andy9775 May 21, 2020
f998e43
build(examples/cdk/overlay): update dev-app bazel to include overlay …
andy9775 May 21, 2020
a76de2c
docs(examples/cdk/overlay): update dev-app routing to include overlay
andy9775 May 21, 2020
eed1455
docs(examples/cdk/overlay): add a basic overlay example
andy9775 May 22, 2020
80466f3
style(examples/cdk/overlay): fix bazel linting error for overlay example
andy9775 May 22, 2020
42a8259
docs(examples/cdk/overlay): remote unused constructor
andy9775 May 22, 2020
6c0085f
docs(examples/cdk/overlay): remote unnecessary boolean type
andy9775 May 22, 2020
354c2f4
Merge branch 'master' of github.com:angular/components into example-b…
andy9775 May 22, 2020
e763193
docs(examples/cdk/overlay): move simple overlay example to existing d…
andy9775 May 22, 2020
5ab6161
Revert "docs(examples/cdk/overlay): add overlay example component to …
andy9775 May 22, 2020
f58f199
Revert "build(examples/cdk/overlay): add bazel build script for overl…
andy9775 May 22, 2020
d93828d
Revert "build(examples/cdk/overlay): update dev-app bazel to include …
andy9775 May 22, 2020
ae0fbdc
Revert "docs(examples/cdk/overlay): update dev-app routing to include…
andy9775 May 22, 2020
7f57724
docs(examples/cdk/overlay): remove long comment
andy9775 May 22, 2020
db88f66
docs(examples/cdk/overlay): remove angular material from overlay cdk …
andy9775 May 22, 2020
753cffa
docs(examples/cdk/overlay): fix css linting errors on overlay example
andy9775 May 22, 2020
deb1e4f
docs(examples/cdk/overlay): remove <hr/> from example and use css to …
andy9775 May 27, 2020
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
1 change: 1 addition & 0 deletions src/components-examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ALL_EXAMPLES = [
"//src/components-examples/cdk/drag-drop",
"//src/components-examples/cdk/clipboard",
"//src/components-examples/cdk/a11y",
"//src/components-examples/cdk/overlay",
"//src/components-examples/cdk-experimental/popover-edit",
]

Expand Down
25 changes: 25 additions & 0 deletions src/components-examples/cdk/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("//tools:defaults.bzl", "ng_module")

package(default_visibility = ["//visibility:public"])

ng_module(
name = "overlay",
srcs = glob(["**/*.ts"]),
assets = glob([
"**/*.html",
"**/*.css",
]),
module_name = "@angular/components-examples/cdk/overlay",
deps = [
"//src/cdk/overlay",
],
)

filegroup(
name = "source-files",
srcs = glob([
"**/*.html",
"**/*.css",
"**/*.ts",
]),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.example-list {
width: 100px;
border: solid 1px #ccc;
border-radius: 5px;
background: #fff;
text-align: center;
padding: 10px;
margin: 0;
}

.example-list > li {
list-style-type: none;
border-bottom: solid 1px #8b8b8b;
padding: 8px 0;
}

.example-list > li:last-child {
border-bottom: none;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- This button triggers the overlay and is it's origin -->
<button (click)="isOpen = !isOpen" type="button" cdkOverlayOrigin #trigger="cdkOverlayOrigin">
{{isOpen ? "Close" : "Open"}}
</button>

<!-- This template displays the overlay content and is connected to the button -->
<ng-template
cdkConnectedOverlay
[cdkConnectedOverlayOrigin]="trigger"
[cdkConnectedOverlayOpen]="isOpen"
>
<ul class="example-list">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {Component} from '@angular/core';

/**
* @title Overlay basic example
*/
@Component({
selector: 'cdk-overlay-basic-example',
templateUrl: './cdk-overlay-basic-example.html',
styleUrls: ['./cdk-overlay-basic-example.css'],
})
export class CdkOverlayBasicExample {
isOpen = false;
}
16 changes: 16 additions & 0 deletions src/components-examples/cdk/overlay/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {NgModule} from '@angular/core';
import {OverlayModule} from '@angular/cdk/overlay';

import {CdkOverlayBasicExample} from './cdk-overlay-basic/cdk-overlay-basic-example';

export {CdkOverlayBasicExample};

const EXAMPLES = [CdkOverlayBasicExample];

@NgModule({
imports: [OverlayModule],
declarations: EXAMPLES,
exports: EXAMPLES,
entryComponents: EXAMPLES,
})
export class CdkOverlayExamplesModule {}
1 change: 1 addition & 0 deletions src/dev-app/connected-overlay/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ng_module(
"//src/cdk/bidi",
"//src/cdk/overlay",
"//src/cdk/portal",
"//src/components-examples/cdk/overlay",
"//src/material/button",
"//src/material/checkbox",
"//src/material/radio",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ import {MatButtonModule} from '@angular/material/button';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatRadioModule} from '@angular/material/radio';
import {RouterModule} from '@angular/router';
import {CdkOverlayExamplesModule} from '@angular/components-examples/cdk/overlay';

import {ConnectedOverlayDemo} from './connected-overlay-demo';

@NgModule({
imports: [
CdkOverlayExamplesModule,
CommonModule,
FormsModule,
MatButtonModule,
Expand All @@ -28,5 +31,4 @@ import {ConnectedOverlayDemo} from './connected-overlay-demo';
],
declarations: [ConnectedOverlayDemo],
})
export class ConnectedOverlayDemoModule {
}
export class ConnectedOverlayDemoModule {}
5 changes: 5 additions & 0 deletions src/dev-app/connected-overlay/connected-overlay-demo.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<h3>Basic overlay</h3>
<cdk-overlay-basic-example></cdk-overlay-basic-example>

<div style="height: 500px"></div>

<h3>Debug Overlay</h3>

<div class="demo-options-connected-overlay mat-typography">
<div>
<h2>Origin X</h2>
Expand Down