Skip to content

Commit 9b0d9a7

Browse files
committed
Refactor Border Radius struct
1 parent ac90ec9 commit 9b0d9a7

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

packages/examples/packages/browserify-plugin/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "BiCtwmtmQRs6IrssjgH8PXZWH7afx75+RKXMnl9KDZ8=",
10+
"shasum": "B0senywfM+w5lQ+iMvK+bVcKJ6VeLDj7HiUVYR5Cuag=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/browserify/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "9K88gT7CbGCXTc/Qx63zbS91VQtHTkFFXWLjyXoM6YU=",
10+
"shasum": "PS0U7SHYXWpFhO8QMtArHKU1rFzMkwtTLFlc3/g1HQ4=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snaps-sdk/src/jsx/validation.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,22 @@ function elementWithSelectiveProps<
215215
});
216216
}
217217

218+
/**
219+
* Shared struct used to validate border radius values used by various Snaps components.
220+
*/
221+
export const BorderRadiusStruct = nullUnion([
222+
literal('none'),
223+
literal('medium'),
224+
literal('full'),
225+
]);
226+
218227
/**
219228
* A struct for the {@link ImageElement} type.
220229
*/
221230
export const ImageStruct: Describe<ImageElement> = element('Image', {
222231
src: svg(),
223232
alt: optional(string()),
224-
borderRadius: optional(
225-
nullUnion([literal('none'), literal('medium'), literal('full')]),
226-
),
233+
borderRadius: optional(BorderRadiusStruct),
227234
});
228235

229236
const IconNameStruct: Struct<`${IconName}`, null> = nullUnion(
@@ -698,9 +705,7 @@ export const LinkStruct: Describe<LinkElement> = element('Link', {
698705
export const SkeletonStruct: Describe<SkeletonElement> = element('Skeleton', {
699706
width: optional(union([number(), string()])),
700707
height: optional(union([number(), string()])),
701-
borderRadius: optional(
702-
nullUnion([literal('none'), literal('medium'), literal('full')]),
703-
),
708+
borderRadius: optional(BorderRadiusStruct),
704709
});
705710

706711
/**

0 commit comments

Comments
 (0)