Direction.jsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import React, { useState } from 'react';
  2. import ColumnAlign from '../v2/columnAlign';
  3. import { Direction } from '../../interface';
  4. import { Space, Button, ConfigProvider } from '../../../';
  5. function App() {
  6. const [propDirection, setDirection] = React.useState<Direction>('ltr');
  7. return (
  8. <Space vertical align="start">
  9. <Space>
  10. <span>table direction = {propDirection}</span>
  11. <span>ConfigProvider direction = rtl</span>
  12. <Button onClick={() => setDirection('ltr')}>table prop ltr</Button>
  13. <Button onClick={() => setDirection('rtl')}>table prop rtl</Button>
  14. <Button onClick={() => setDirection()}>table prop undefined</Button>
  15. </Space>
  16. <div style={{ width: 800 }}>
  17. <ConfigProvider direction='rtl'>
  18. <ColumnAlign direction={propDirection} />
  19. </ConfigProvider>
  20. </div>
  21. </Space>
  22. );
  23. }
  24. App.storyName = 'table direction rtl';
  25. App.parameters = {
  26. chromatic: { disableSnapshot: false },
  27. };
  28. export default App;