= (props) => {
if (!isNilOrEmpty(day)) {
newDate = setDate(currentDate, day);
}
- setValue(newDate);
if (!isNilOrEmpty(onChange)) {
onChange(newDate);
}
diff --git a/packages/documentation/src/pages/ButtonPage/components/__tests__/__snapshots__/index-test.tsx.snap b/packages/documentation/src/pages/ButtonPage/components/__tests__/__snapshots__/index-test.tsx.snap
deleted file mode 100644
index 5a5d26f7..00000000
--- a/packages/documentation/src/pages/ButtonPage/components/__tests__/__snapshots__/index-test.tsx.snap
+++ /dev/null
@@ -1,151 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`(component) ButtonPage should match snapshot 1`] = `
-
-
- Button
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/documentation/src/pages/ButtonPage/components/__tests__/index-test.tsx b/packages/documentation/src/pages/ButtonPage/components/__tests__/index-test.tsx
deleted file mode 100644
index e868123b..00000000
--- a/packages/documentation/src/pages/ButtonPage/components/__tests__/index-test.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react';
-
-import { shallow } from 'enzyme';
-
-import ButtonPage from '../';
-
-describe('(component) ButtonPage', () => {
- it('should match snapshot', () => {
- expect(shallow(
)).toMatchSnapshot();
- });
-});
diff --git a/packages/documentation/src/pages/ButtonPage/components/index.tsx b/packages/documentation/src/pages/ButtonPage/components/index.tsx
deleted file mode 100644
index 37ba8f64..00000000
--- a/packages/documentation/src/pages/ButtonPage/components/index.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import React from 'react';
-
-import Button from '@treejs/components/Button';
-import { Grid, GridCol } from '@treejs/components/Grid';
-import Section from '@treejs/components/Section';
-import Title from '@treejs/components/Title';
-import { TITLE_SPACE_ENUM } from '@treejs/components/Title/types';
-import { getMessage } from '@treejs/localization/message';
-import { STATUS } from '@treejs/types/common';
-import { noop } from '@treejs/utils';
-
-import API from 'documentation/components/API';
-import Code from 'documentation/components/Code';
-import { ButtonLocalization } from 'documentation/localization/button';
-import { MenuLocalization } from 'documentation/localization/menu';
-import { generateDocumentationObject } from 'documentation/utils/documentation';
-
-import { children, groups } from '../typedoc.json';
-
-const propDefinition = generateDocumentationObject(groups, children);
-
-const ButtonPage = (): React.ReactElement => {
- return (
- <>
-
- {getMessage(MenuLocalization.button)}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- );
-};
-
-export default ButtonPage;
diff --git a/packages/documentation/src/pages/CalendarPage/components/Calendar.tsx b/packages/documentation/src/pages/CalendarPage/components/Calendar.tsx
deleted file mode 100644
index 15ab6254..00000000
--- a/packages/documentation/src/pages/CalendarPage/components/Calendar.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import React, { useCallback, useState } from 'react';
-
-import Calendar from '@treejs/components/Calendar/components/Calendar';
-import { CALENDAR_VIEW } from '@treejs/components/Calendar/types';
-import { Grid, GridCol } from '@treejs/components/Grid';
-import { GRID_SIZE_ENUM } from '@treejs/components/Grid/types';
-import Section from '@treejs/components/Section';
-import Title from '@treejs/components/Title';
-import { TITLE_SPACE_ENUM } from '@treejs/components/Title/types';
-import { getMessage } from '@treejs/localization/message';
-
-import API from 'documentation/components/API';
-import Code from 'documentation/components/Code';
-import { MenuLocalization } from 'documentation/localization/menu';
-import { CustomDayInWeek } from 'documentation/pages/CalendarPage/components/CustomDayInWeek';
-import { generateDocumentationObject } from 'documentation/utils/documentation';
-
-import { children, groups } from '../typedoc.json';
-import CalendarTimeColumn from './CalendarTimeColumn';
-import { CustomDayInMonth } from './CustomDayInMonth';
-
-const propDefinition = generateDocumentationObject(groups, children);
-const customDetailPropDefinition = generateDocumentationObject(groups, children, 'DetailComponentProps');
-
-const CalendarPage = (): React.ReactElement => {
- const [calendar, setCalendar] = useState(new Date());
-
- const handleChangeCalendar = useCallback((value) => {
- setCalendar(value);
- }, []);
-
- return (
- <>
-
- {getMessage(MenuLocalization.calendar)}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- );
-};
-
-export default CalendarPage;
diff --git a/packages/documentation/src/pages/CalendarPage/components/CalendarHourCell.tsx b/packages/documentation/src/pages/CalendarPage/components/CalendarHourCell.tsx
deleted file mode 100644
index e967d09d..00000000
--- a/packages/documentation/src/pages/CalendarPage/components/CalendarHourCell.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-
-import cx from 'classnames';
-
-type IProps = {
- children?: any;
- className?: string;
- onClick?: (event: any) => void;
- value: Date;
-};
-
-const CalendarHourCell: React.FC
= (props) => {
- const { className, onClick, children } = props;
- return (
-
- {children}
-
- );
-};
-
-export default CalendarHourCell;
diff --git a/packages/documentation/src/pages/CalendarPage/components/CalendarTimeColumn.tsx b/packages/documentation/src/pages/CalendarPage/components/CalendarTimeColumn.tsx
deleted file mode 100644
index d9edef91..00000000
--- a/packages/documentation/src/pages/CalendarPage/components/CalendarTimeColumn.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import { times } from 'ramda';
-
-import { addMinutes, format } from 'date-fns';
-
-import CalendarHourCell from './CalendarHourCell';
-
-const CalendarTimeColumn: React.FC = () => {
- return (
-
-
- {times(
- (i) => (
-
- {format(addMinutes(new Date(0, 0, 0, 8, 0), 30 * i), 'kk:mm')}
-
-
-
- ),
- 16
- )}
-
- );
-};
-
-export default CalendarTimeColumn;
diff --git a/packages/documentation/src/pages/CalendarPage/components/CustomDayInMonth.tsx b/packages/documentation/src/pages/CalendarPage/components/CustomDayInMonth.tsx
deleted file mode 100644
index 23bfb504..00000000
--- a/packages/documentation/src/pages/CalendarPage/components/CustomDayInMonth.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import React, { useMemo } from 'react';
-import { times } from 'ramda';
-
-import { format } from 'date-fns';
-
-import CalendarCell from '@treejs/components/Calendar/components/CalendarCell';
-import { DetailComponentProps } from '@treejs/components/Calendar/types';
-
-export const CustomDayInMonth: React.FC = (props) => {
- const { value, isToday, isSelected, onClick } = props;
-
- const todayDay = format(value, 'dd');
-
- const agenda = useMemo<{ [key: string]: React.ReactElement }>(() => {
- const list: { [key: string]: React.ReactElement } = {};
- times((i) => {
- list[todayDay] = (
-
- );
- }, Math.round(Math.random()));
- return list;
- }, [todayDay, todayDay]);
-
- return (
-
-
-
{format(value, 'dd')}
- {agenda[todayDay]}
-
-
- );
-};
diff --git a/packages/documentation/src/pages/CalendarPage/components/CustomDayInWeek.tsx b/packages/documentation/src/pages/CalendarPage/components/CustomDayInWeek.tsx
deleted file mode 100644
index f065fe33..00000000
--- a/packages/documentation/src/pages/CalendarPage/components/CustomDayInWeek.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import React, { useCallback, useMemo } from 'react';
-import { times } from 'ramda';
-
-import cx from 'classnames';
-import { addMinutes, format } from 'date-fns';
-
-import CalendarCell from '@treejs/components/Calendar/components/CalendarCell';
-import { DetailComponentProps } from '@treejs/components/Calendar/types';
-import { isNilOrEmpty } from '@treejs/utils';
-
-import CalendarHourCell from 'documentation/pages/CalendarPage/components/CalendarHourCell';
-
-export const CustomDayInWeek: React.FC = (props) => {
- const { value, isToday, onClick, hover } = props;
-
- const handleClick = useCallback(
- (value) => () => {
- if (!isNilOrEmpty(onClick)) {
- onClick(value);
- }
- },
- [onClick]
- );
-
- const agenda = useMemo(() => {
- return times((i) => {
- const value = addMinutes(new Date(props.value).setHours(8, 0, 0, 0), 30 * i);
- if (Math.round(Math.random())) {
- return (
-
- );
- } else {
- return (
-
- event
-
- );
- }
- }, 16);
- }, [props.value]);
-
- return (
-
- {format(value, 'dd')}
- {agenda}
-
- );
-};
diff --git a/stories/Introduction.stories.mdx b/stories/Introduction.stories.mdx
index 9e2015a8..9ac45d2c 100644
--- a/stories/Introduction.stories.mdx
+++ b/stories/Introduction.stories.mdx
@@ -1,4 +1,4 @@
-import { Meta } from '@storybook/addon-docs/blocks';
+import { Meta } from "@storybook/addon-docs/blocks";
diff --git a/stories/components/Button/Button.stories.mdx b/stories/components/Button/Button.stories.mdx
new file mode 100644
index 00000000..639b7ac0
--- /dev/null
+++ b/stories/components/Button/Button.stories.mdx
@@ -0,0 +1,41 @@
+import Button from "@treejs/components/Button";
+import { STATUS } from "@treejs/types/common";
+import { ArgsTable, Story, Preview, Primary } from "@storybook/addon-docs";
+import { action } from "@storybook/addon-actions";
+
+
+
+# Button
+
+`import Button from '@treejs/components/Button';`
+
+
+export const Template = (args) =>
+
+## Default Button
+We can write the documentation related to the Default Button
+
+
+ {Template.bind({})}
+
+
+
+## Large Button
+We are writing sample docs for two stories, you can write rest of them
+
+
+ {Template.bind({})}
+
+
+
+
\ No newline at end of file
diff --git a/stories/components/Button/Button.stories.tsx b/stories/components/Button/Button.storiesX.tsx
similarity index 54%
rename from stories/components/Button/Button.stories.tsx
rename to stories/components/Button/Button.storiesX.tsx
index 59f41b37..6ed8a5d1 100644
--- a/stories/components/Button/Button.stories.tsx
+++ b/stories/components/Button/Button.storiesX.tsx
@@ -1,19 +1,31 @@
import React from 'react';
+import { action } from '@storybook/addon-actions';
import { Meta, Story } from '@storybook/react';
import Button, { ButtonType } from '@treejs/components/Button';
-import { STATUS } from '@treejs/types/common';
const Template: Story = (args) => ;
export const Default = Template.bind({});
Default.args = {
label: 'Button',
- status: STATUS.none,
+ onClick: action('clicked'),
+};
+
+export const WithElement = Template.bind({});
+WithElement.args = {
+ label: Element,
+ onClick: action('clicked'),
};
export default {
title: 'Components/Button',
component: Button,
+ parameters: {
+ layout: 'centered',
+ docs: {
+ page: require('./Button.stories.mdx').default,
+ },
+ },
} as Meta;
diff --git a/stories/components/Calendar/Calendar.stories.tsx b/stories/components/Calendar/Calendar.stories.tsx
index b3f1bdf8..11e5feb7 100644
--- a/stories/components/Calendar/Calendar.stories.tsx
+++ b/stories/components/Calendar/Calendar.stories.tsx
@@ -13,26 +13,23 @@ const Template: Story = (args) => ;
export const Mini = Template.bind({});
Mini.args = {
- key: 'mini',
title: 'Mini calendar',
hover: true,
};
export const Month = Template.bind({});
Month.args = {
- key: 'month',
title: 'Month calendar',
- detailComponent: CustomDayInMonth,
+ detail: CustomDayInMonth,
type: CALENDAR_VIEW.MONTH,
hover: true,
};
export const Week = Template.bind({});
Week.args = {
- key: 'week',
title: 'Week calendar',
- detailComponent: CustomDayInWeek,
- timeColumnComponent: CalendarTimeColumn,
+ detail: CustomDayInWeek,
+ timeColumn: CalendarTimeColumn,
type: CALENDAR_VIEW.WEEK,
hover: true,
};
diff --git a/tsconfig.json b/tsconfig.json
index bee84187..c04da73a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -29,12 +29,13 @@
},
"types": [
"node",
- "jest"
+ "jest",
]
},
"include": [
"./**/*.ts",
- "./**/*.tsx"
+ "./**/*.tsx",
+ "./**/*.mdx"
],
"exclude": [
"node_modules",