Skip to content

Commit a17b83a

Browse files
RodgeFubterlsontimotheeguerin
authored
add region support in csharp (#319)
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com> Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
1 parent a283f12 commit a17b83a

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: feature
3+
packages:
4+
- "@alloy-js/csharp"
5+
---
6+
7+
Add `#region` support
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Children } from "@alloy-js/core/jsx-runtime";
2+
import { expect, it } from "vitest";
3+
import { TestNamespace } from "../../../test/utils.jsx";
4+
import { Region } from "./region.jsx";
5+
6+
const Wrapper = (props: { name: string; children: Children }) => (
7+
<TestNamespace>
8+
<Region name={props.name}>{props.children}</Region>
9+
</TestNamespace>
10+
);
11+
12+
it("region test", () => {
13+
expect(<Wrapper name="Test Region">// This is inside region</Wrapper>)
14+
.toRenderTo(`
15+
#region Test Region
16+
// This is inside region
17+
#endregion
18+
`);
19+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Children, code, List } from "@alloy-js/core";
2+
3+
export interface RegionProps {
4+
name: string;
5+
children: Children;
6+
}
7+
8+
export function Region(props: RegionProps) {
9+
return (
10+
<List>
11+
{code`#region ${props.name}`}
12+
{props.children}
13+
{code`#endregion`}
14+
</List>
15+
);
16+
}

0 commit comments

Comments
 (0)