-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 0.1.0-alpha.3 - Anchored region
- Loading branch information
Showing
10 changed files
with
459 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletions
198
src/AdaptiveBlazor.Storybook/Stories/AnchoredRegion/AnchoredRegion.stories.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
@attribute [Stories("Components/Anchored region")] | ||
|
||
<Stories TComponent="@AdaptiveAnchoredRegion" Layout="typeof(AnchoredRegionLayout)"> | ||
<Story Name="Default"> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
|
||
<Story Name="Relative placement: Adjacent vertically and inset horizontally"> | ||
@* TODO add as description *@ | ||
@* By default the anchored region is positioned adjacent to the element it is anchored to, but if the "horizontal-inset" or "vertical-inset" attributes are set then the region will be 'inset' and overlap the anchor on that axis. Various combinations of these attributes can enable some commonly desired layouts. In the following images the menu would be considered to be the anchored region and the "Select an option" button the anchor. *@ | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.HorizontalInset" Value="true" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="Relative placement: Inset vertically and adjacent horizontally"> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.VerticalInset" Value="true" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="Relative placement: Inset on both axis positions"> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.HorizontalInset" Value="true" /> | ||
<Arg For="_ => _.VerticalInset" Value="true" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId" style="min-width: 200px;">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="Relative placement: Adjacent on both axis positions"> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="A region that always renders above the anchor element."> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.VerticalPositioningMode" Value="@AxisPositioningMode.Locktodefault" /> | ||
<Arg For="_ => _.VerticalDefaultPosition" Value="@VerticalPosition.Top" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId" style="align-self: flex-start;">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="A region that renders above or below the anchor depending on available space."> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.VerticalPositioningMode" Value="@AxisPositioningMode.Dynamic" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId" style="align-self: flex-start;">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="A region that overlaps the anchor and renders above or below it depending on available space."> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.VerticalPositioningMode" Value="@AxisPositioningMode.Dynamic" /> | ||
<Arg For="_ => _.VerticalInset" Value="true" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId" style="align-self: flex-end;">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
<Story Name="A region that renders above the anchor until that space is less than 250px."> | ||
<Arguments> | ||
<Arg For="_ => _.Anchor" Value="@anchorId" /> | ||
<Arg For="_ => _.VerticalPositioningMode" Value="@AxisPositioningMode.Dynamic" /> | ||
<Arg For="_ => _.VerticalDefaultPosition" Value="@VerticalPosition.Top" /> | ||
<Arg For="_ => _.VerticalThreshold" Value="250" /> | ||
</Arguments> | ||
<Template> | ||
<adaptive-button id="@anchorId" style="align-self: center;">This is anchor</adaptive-button> | ||
|
||
<AdaptiveAnchoredRegion @attributes="context.Args"> | ||
<adaptive-menu> | ||
<adaptive-menu-item> | ||
Item 1 | ||
</adaptive-menu-item> | ||
<adaptive-menu-item> | ||
Item 2 | ||
</adaptive-menu-item> | ||
</adaptive-menu> | ||
</AdaptiveAnchoredRegion> | ||
</Template> | ||
</Story> | ||
</Stories> | ||
|
||
|
||
|
||
|
||
@code | ||
{ | ||
private string anchorId = "anchor"; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/AdaptiveBlazor.Storybook/Stories/AnchoredRegion/AnchoredRegionLayout.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@inherits LayoutComponentBase | ||
@layout DefaultLayout | ||
|
||
<div id="wrapper"> | ||
<div id="anchored-region-content"> | ||
@Body | ||
</div> | ||
</div> | ||
|
||
|
||
<style> | ||
#wrapper | ||
{ | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
#anchored-region-content | ||
{ | ||
min-height: 200px; | ||
min-width: 500px; | ||
display: flex; | ||
border: 1px solid; | ||
align-items: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/AdaptiveBlazor/Components/AnchoredRegion/AdaptiveAnchoredRegion.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@namespace AdaptiveBlazor.Components | ||
@inherits AdaptiveComponentBase | ||
|
||
<adaptive-anchored-region | ||
id="@Id" | ||
class="@Class" | ||
style="@Style" | ||
anchor="@Anchor" | ||
viewport="@Viewport" | ||
horizontal-positioning-mode="@HorizontalPositioningMode?.ToAttribute()" | ||
horizontal-default-position="@HorizontalDefaultPosition?.ToAttribute()" | ||
horizontal-viewport-lock=@HorizontalViewportLock | ||
horizontal-inset="@HorizontalInset" | ||
horizontal-threshold="@HorizontalThreshold" | ||
horizontal-scaling="@HorizontalScaling?.ToAttribute()" | ||
vertical-positioning-mode="@VerticalPositioningMode?.ToAttribute()" | ||
vertical-default-position="@VerticalDefaultPosition?.ToAttribute()" | ||
vertical-viewport-lock=@VerticalViewportLock | ||
vertical-inset="@VerticalInset" | ||
vertical-threshold="@VerticalThreshold" | ||
vertical-scaling="@VerticalScaling?.ToAttribute()" | ||
fixed-placement=@FixedPlacement | ||
auto-update-mode="@AutoUpdateMode?.ToAttribute()" | ||
@attributes="AdditionalAttributes"> | ||
|
||
@ChildContent | ||
</adaptive-anchored-region> |
Oops, something went wrong.