Skip to content

Commit

Permalink
add story
Browse files Browse the repository at this point in the history
  • Loading branch information
kof committed Dec 4, 2024
1 parent 5db2b57 commit 7ad83ed
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,43 @@ export const WithUnits = () => {
</Flex>
);
};

export const AutoScroll = () => {
const [value, setValue] = React.useState<StyleValue>({
type: "var",
value: "start-test-test-test-test-test-test-test-end",
});

const [intermediateValue, setIntermediateValue] = React.useState<
StyleValue | IntermediateStyleValue
>();

return (
<Flex css={{ width: 100 }}>
<CssValueInput
styleSource="preset"
property="alignItems"
value={value}
intermediateValue={intermediateValue}
onChange={(newValue) => {
setIntermediateValue(newValue);
}}
onHighlight={(value) => {
action("onHighlight")(value);
}}
onChangeComplete={({ value }) => {
// on blur, select, enter etc.
setValue(value);
setIntermediateValue(undefined);
action("onChangeComplete")(value);
}}
onAbort={() => {
action("onAbort")();
}}
onReset={() => {
action("onReset")();
}}
/>
</Flex>
);
};
12 changes: 0 additions & 12 deletions packages/design-system/src/components/input-field.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ export const Demo = () => (
))}
</StoryGrid>
</StorySection>

<StorySection title="Auto Scroll">
<StoryGrid horizontal>
<InputField
autoScroll
defaultValue="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor"
prefix={prefix}
suffix={suffix}
autoFocus
/>
</StoryGrid>
</StorySection>
</>
);

Expand Down

0 comments on commit 7ad83ed

Please sign in to comment.