Skip to content

Commit 5df3f75

Browse files
allan-chencopybara-github
authored andcommitted
feat(button): add remaining link variants
PiperOrigin-RevId: 403488252
1 parent b78eee8 commit 5df3f75

File tree

8 files changed

+203
-0
lines changed

8 files changed

+203
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {customElement} from 'lit/decorators';
8+
9+
import {styles as elevationOverlayStyles} from '../elevation/lib/elevation-overlay-styles.css';
10+
11+
import {ElevatedLinkButton} from './lib/elevated-link-button';
12+
import {styles as elevatedStyles} from './lib/elevated-styles.css';
13+
import {styles as sharedStyles} from './lib/shared-styles.css';
14+
15+
declare global {
16+
interface HTMLElementTagNameMap {
17+
'md-elevated-link-button': MdElevatedLinkButton;
18+
}
19+
}
20+
21+
/**
22+
* @soyCompatible
23+
* @final
24+
* @suppress {visibility}
25+
*/
26+
@customElement('md-elevated-link-button')
27+
export class MdElevatedLinkButton extends ElevatedLinkButton {
28+
static override styles =
29+
[elevationOverlayStyles, sharedStyles, elevatedStyles];
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {html, TemplateResult} from 'lit';
8+
import {ClassInfo} from 'lit/directives/class-map';
9+
10+
import {LinkButton} from './link-button';
11+
12+
/** @soyCompatible */
13+
export class ElevatedLinkButton extends LinkButton {
14+
/** @soyTemplate */
15+
protected override getRenderClasses(): ClassInfo {
16+
return {
17+
...super.getRenderClasses(),
18+
'md3-button--elevated': true,
19+
};
20+
}
21+
22+
/** @soyTemplate */
23+
protected override renderOverlay(): TemplateResult {
24+
return html`<div class="md3-elevation-overlay"></div>`;
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {html, TemplateResult} from 'lit';
8+
import {ClassInfo} from 'lit/directives/class-map';
9+
10+
import {LinkButton} from './link-button';
11+
12+
/** @soyCompatible */
13+
export class OutlinedLinkButton extends LinkButton {
14+
/** @soyTemplate */
15+
protected override getRenderClasses(): ClassInfo {
16+
return {
17+
...super.getRenderClasses(),
18+
'md3-button--outlined': true,
19+
};
20+
}
21+
22+
/** @soyTemplate */
23+
protected override renderOutline(): TemplateResult {
24+
return html`<span class="md3-button__outline"></span>`;
25+
}
26+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {ClassInfo} from 'lit/directives/class-map';
8+
9+
import {LinkButton} from './link-button';
10+
11+
/** @soyCompatible */
12+
export class TextLinkButton extends LinkButton {
13+
/** @soyTemplate */
14+
protected override getRenderClasses(): ClassInfo {
15+
return {
16+
...super.getRenderClasses(),
17+
'md3-button--text': true,
18+
};
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {ClassInfo} from 'lit/directives/class-map';
8+
9+
import {LinkButton} from './link-button';
10+
11+
/** @soyCompatible */
12+
export class TonalLinkButton extends LinkButton {
13+
/** @soyTemplate */
14+
protected override getRenderClasses(): ClassInfo {
15+
return {
16+
...super.getRenderClasses(),
17+
'md3-button--tonal': true,
18+
};
19+
}
20+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {customElement} from 'lit/decorators';
8+
9+
import {OutlinedLinkButton} from './lib/outlined-link-button';
10+
import {styles as outlinedStyles} from './lib/outlined-styles.css';
11+
import {styles as sharedStyles} from './lib/shared-styles.css';
12+
13+
declare global {
14+
interface HTMLElementTagNameMap {
15+
'md-outlined-link-button': MdOutlinedLinkButton;
16+
}
17+
}
18+
19+
/**
20+
* @soyCompatible
21+
* @final
22+
* @suppress {visibility}
23+
*/
24+
@customElement('md-outlined-link-button')
25+
export class MdOutlinedLinkButton extends OutlinedLinkButton {
26+
static override styles = [sharedStyles, outlinedStyles];
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {customElement} from 'lit/decorators';
8+
9+
import {styles as sharedStyles} from './lib/shared-styles.css';
10+
import {TextLinkButton} from './lib/text-link-button';
11+
import {styles as textStyles} from './lib/text-styles.css';
12+
13+
declare global {
14+
interface HTMLElementTagNameMap {
15+
'md-text-link-button': MdTextLinkButton;
16+
}
17+
}
18+
19+
/**
20+
* @soyCompatible
21+
* @final
22+
* @suppress {visibility}
23+
*/
24+
@customElement('md-text-link-button')
25+
export class MdTextLinkButton extends TextLinkButton {
26+
static override styles = [sharedStyles, textStyles];
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import {customElement} from 'lit/decorators';
8+
9+
import {styles as sharedStyles} from './lib/shared-styles.css';
10+
import {TonalLinkButton} from './lib/tonal-link-button';
11+
import {styles as tonalStyles} from './lib/tonal-styles.css';
12+
13+
declare global {
14+
interface HTMLElementTagNameMap {
15+
'md-tonal-link-button': MdTonalLinkButton;
16+
}
17+
}
18+
19+
/**
20+
* @soyCompatible
21+
* @final
22+
* @suppress {visibility}
23+
*/
24+
@customElement('md-tonal-link-button')
25+
export class MdTonalLinkButton extends TonalLinkButton {
26+
static override styles = [sharedStyles, tonalStyles];
27+
}

0 commit comments

Comments
 (0)