Skip to content

Commit 476a0cb

Browse files
vnbaaijdvoituron
andauthored
[Anchor] Revert #2624 and replace with a better solution (#2640)
Co-authored-by: Denis Voituron <[email protected]>
1 parent 264745d commit 476a0cb

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

examples/Demo/Shared/Pages/Anchor/AnchorPage.razor

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525

2626
<DemoSection Title="Appearance" Component="@typeof(AnchorAppearance)" CollocatedFiles="@(new[] {"css"})"></DemoSection>
2727

28-
<DemoSection Title="Anchors with icons" Component="@typeof(AnchorIcons)"></DemoSection>
28+
<DemoSection Title="Anchors with icons" Component="@typeof(AnchorIcons)">
29+
<Description>
30+
<p>By placing the icon the content of the anchor, it is possible to specify a <code>Color</code> for the icon.</p>
31+
</Description>
32+
</DemoSection>
2933

3034
<h2 id="documentation">Documentation</h2>
3135

examples/Demo/Shared/Pages/Anchor/Examples/AnchorIcons.razor

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
11
<h4>Neutral appearane</h4>
22
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 1em;">
33
<FluentAnchor Href="#" IconStart="@(new Icons.Regular.Size16.Globe())">
4-
With icon at start
4+
Icon at start
55
</FluentAnchor>
66

77
<FluentAnchor Href="#" IconEnd="@(new Icons.Regular.Size16.Globe())">
8-
With icon at end
8+
Icon at end
9+
</FluentAnchor>
10+
11+
<FluentAnchor Href="#">
12+
<FluentIcon Value="@(new Icons.Regular.Size16.Globe())" Color="@Color.Success" Slot="start" />
13+
Icon at start in content
14+
</FluentAnchor>
15+
16+
<FluentAnchor Href="#">
17+
Icon at end in content
18+
<FluentIcon Value="@(new Icons.Regular.Size16.Globe())" Color="@Color.Success" Slot="end" />
919
</FluentAnchor>
1020
</div>
1121
<h4>Hypertext appearane</h4>
1222
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 1em;">
1323
<FluentAnchor Appearance="@Appearance.Hypertext" Href="#" IconStart="@(new Icons.Regular.Size16.Globe())">
14-
With icon at start
24+
Icon at start
1525
</FluentAnchor>
1626

1727
<FluentAnchor Appearance="@Appearance.Hypertext" Href="#" IconEnd="@(new Icons.Regular.Size16.Globe())">
18-
With icon at end
28+
Icon at end
1929
</FluentAnchor>
20-
</div>
2130

22-
<p>With icon in the content. By doing it this way, it is possible to specify <code>Color</code> for the icon.</p>
23-
<FluentAnchor Href="#">
24-
With icon in content
25-
<FluentIcon Value="@(new Icons.Regular.Size32.Globe())" Color="@Color.Success" Slot="end" />
26-
</FluentAnchor>
31+
<FluentAnchor Appearance="@Appearance.Hypertext" Href="#">
32+
<FluentIcon Value="@(new Icons.Regular.Size16.Globe())" Color="@Color.Success" Slot="start" />
33+
Icon at start in content
34+
</FluentAnchor>
2735

28-
<FluentAnchor Appearance="@Appearance.Hypertext" Href="#">
29-
With icon in content
30-
<FluentIcon Value="@(new Icons.Regular.Size32.Globe())" Color="@Color.Success" Slot="end" />
31-
</FluentAnchor>
36+
<FluentAnchor Appearance="@Appearance.Hypertext" Href="#">
37+
Icon at start in content
38+
<FluentIcon Value="@(new Icons.Regular.Size16.Globe())" Color="@Color.Success" Slot="end" />
39+
</FluentAnchor>
40+
</div>
3241

3342
<div style="display: flex; align-items: center; gap: 10px; margin-top: 1em;">
3443
With icon in default slot:
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
fluent-anchor[appearance="hypertext"]::part(control) {
2-
display: inline-flex !important;
3-
}
41

52
fluent-anchor[appearance="hypertext"]::part(start) {
3+
display: unset;
4+
position: relative;
5+
top: calc(var(--design-unit)* 1px);
66
margin-inline-end: calc(var(--design-unit) * 1px);
77
}
88

99
fluent-anchor[appearance="hypertext"]::part(end) {
10+
display: unset;
11+
position: relative;
12+
top: calc(var(--design-unit)* 1px);
1013
margin-inline-start: calc(var(--design-unit) * 1px);
1114
}

0 commit comments

Comments
 (0)