Skip to content

Commit 473eb2e

Browse files
committed
Add border attribute
1 parent 85bbbef commit 473eb2e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

block/attributes.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@ interface Attributes {
22
defaultHomeserver?: string,
33
roomId?: string,
44
height: Height,
5+
border: {
6+
width: BorderWidth,
7+
radius: BorderRadius,
8+
style: string,
9+
color: string,
10+
}
511
}
612

713
export function parseAttributes(attributes): Attributes {
814
return {
915
defaultHomeserver: attributes.defaultHomeserver ?? '',
1016
roomId: attributes.roomId ?? '',
1117
height: new Height(attributes.height.value, attributes.height.unit),
18+
border: {
19+
width: new BorderWidth(attributes.border.width.value, attributes.border.width.unit),
20+
radius: new BorderRadius(attributes.border.radius.value, attributes.border.radius.unit),
21+
style: attributes.border.style,
22+
color: attributes.border.color,
23+
}
1224
};
1325
}
1426

@@ -48,3 +60,15 @@ export class Height extends ValueWithUnit {
4860
super(value, unit);
4961
}
5062
}
63+
64+
export class BorderWidth extends ValueWithUnit {
65+
constructor(value: number, unit: Unit | string) {
66+
super(value, unit);
67+
}
68+
}
69+
70+
export class BorderRadius extends ValueWithUnit {
71+
constructor(value: number, unit: Unit | string) {
72+
super(value, unit);
73+
}
74+
}

block/block.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@
2222
"value": 600,
2323
"unit": "px"
2424
}
25+
},
26+
"border": {
27+
"type": "object",
28+
"default": {
29+
"width": {
30+
"value": 1,
31+
"unit": "px"
32+
},
33+
"radius": {
34+
"value": 10,
35+
"unit": "px"
36+
},
37+
"style": "solid",
38+
"color": "black"
39+
}
2540
}
2641
},
2742
"supports": {

0 commit comments

Comments
 (0)