Skip to content

Commit

Permalink
💄 DateSelector - add padding to story
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Castagliola committed Jan 30, 2024
1 parent 6fd55a2 commit 6c6d2d0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Storybook/components/DateSelector/DateSelector.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { DateSelector } from '../../../src/components/dateSelector/DateSelector';
import type { ComponentMeta, ComponentStory } from '@storybook/react-native';
import { action } from '@storybook/addon-actions';
import { StyleSheet, View, Text } from 'react-native';

export default {
Expand All @@ -11,7 +12,9 @@ export default {
},
args: {
prefilled: new Date(2023, 0, 8),
onUpdatedDate: () => true,
onUpdatedDate: (date: Date) => {
action('onChange')(date.toDateString());
},
},
decorators: [
(Story) => {
Expand Down Expand Up @@ -45,16 +48,26 @@ export const WithErrorMessage: ComponentStory<typeof DateSelector> = (args) => {
return !isGreaterThunberg;
};

const styles = getStyles();

return (
<View>
<Text>Enter a date greater than 2030 to be in error</Text>
<Text style={styles.container}>
Enter a date greater than 2030 to be in error.
</Text>
<DateSelector
{...args}
onUpdatedDate={handleUpdatedDate}
errorMessage={error}
/>
</View>
);

function getStyles() {
return StyleSheet.create({
container: { padding: 8 },
});
}
};

function isGreaterThan2030(date: Date): boolean {
Expand Down

0 comments on commit 6c6d2d0

Please sign in to comment.