Skip to content

Commit a92f4ab

Browse files
authored
[UI components]: 2024-01 Docs patch (#2109)
* scrollTo and image source changes * changeset * style helper docs
1 parent 6413af3 commit a92f4ab

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

.changeset/nice-cows-type.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@shopify/ui-extensions-react': patch
3+
'@shopify/ui-extensions': patch
4+
---
5+
6+
ScrollView scrollTo docs changes, image source docs changes

packages/ui-extensions-react/src/surfaces/checkout/components/Image/examples/basic-image.example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export default reactExtension(
1010

1111
function Extension() {
1212
return (
13-
<Image source="https://shopify.dev/assets/api/checkout-extensions/checkout/components/image-example-code.png" />
13+
<Image source="https://cdn.shopify.com/YOUR_IMAGE_HERE" />
1414
);
1515
}

packages/ui-extensions/src/surfaces/checkout/components/Image/examples/basic-image.example.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import {extension, Image} from '@shopify/ui-extensions/checkout';
22

33
export default extension('purchase.checkout.block.render', (root) => {
44
const image = root.createComponent(Image, {
5-
source:
6-
'https://shopify.dev/assets/api/checkout-extensions/checkout/components/image-example-code.png',
5+
source: 'https://cdn.shopify.com/YOUR_IMAGE_HERE',
76
});
87

98
root.appendChild(image);

packages/ui-extensions/src/surfaces/checkout/components/ScrollView/ScrollView.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,23 @@ export interface ScrollViewProps
5656
*/
5757
direction?: 'block' | 'inline';
5858
/**
59-
* Scroll to a specific position or to an element.
59+
* Scroll to a specific position or to an element when the component is first rendered.
60+
*
61+
* This property allows you to set an initial scroll position or scroll to a specific element
62+
* when the `ScrollView` component mounts. Note that this action will only be performed once,
63+
* during the initial render of the component.
64+
*
65+
* @example
66+
* // Scroll to 100 pixels from the top on initial render
67+
* <ScrollView scrollTo={100} />
68+
*
69+
* // Scroll to a specific element on initial render
70+
* const elementRef = useRef(null);
71+
* <ScrollView scrollTo={elementRef.current} />
72+
*
73+
* @note
74+
* This property will only take effect on the first render. Subsequent updates to this property
75+
* will not trigger additional scroll actions.
6076
*/
6177
scrollTo?: number | HTMLElement;
6278
/**

packages/ui-extensions/src/surfaces/checkout/style/types.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,21 @@ export interface ConditionalStyle<
109109

110110
/**
111111
* A type that represents a value that can be a conditional style.
112-
* We highly recommend using the Style helper which simplifies the creation of conditional styles.
112+
* We highly recommend using the `Style` helper which simplifies the creation of conditional styles.
113+
*
113114
* To learn more check out the [conditional styles](/api/checkout-ui-extensions/components/utilities/stylehelper) documentation.
114115
*/
115116
export type MaybeConditionalStyle<
116117
T,
117118
AcceptedConditions extends BaseConditions = Conditions,
118119
> = T | ConditionalStyle<T, AcceptedConditions>;
119120

121+
/**
122+
* A type that represents a value that can be a conditional style. The conditions are based on the viewport size.
123+
* We highly recommend using the `Style` helper which simplifies the creation of conditional styles.
124+
*
125+
* To learn more check out the [conditional styles](/api/checkout-ui-extensions/components/utilities/stylehelper) documentation.
126+
*/
120127
export type MaybeResponsiveConditionalStyle<T> =
121128
| T
122129
| ConditionalStyle<T, ViewportSizeCondition>;

0 commit comments

Comments
 (0)