|
| 1 | +import React from 'react'; |
| 2 | +import { ScrollView } from 'react-native'; |
| 3 | + |
| 4 | +import DirectoryItem from './index'; |
| 5 | +import { themes } from '../../lib/constants'; |
| 6 | + |
| 7 | +const _theme = 'light'; |
| 8 | + |
| 9 | +export default { |
| 10 | + title: 'DirectoryItem', |
| 11 | + decorators: [ |
| 12 | + (Story: any) => ( |
| 13 | + <ScrollView style={{ backgroundColor: themes[_theme].surfaceRoom }}> |
| 14 | + <Story /> |
| 15 | + </ScrollView> |
| 16 | + ) |
| 17 | + ] |
| 18 | +}; |
| 19 | +const onPress = () => console.log('Pressed!'); |
| 20 | + |
| 21 | +export const Default = () => ( |
| 22 | + <DirectoryItem title='General' description='A public room' avatar='G' type='c' onPress={onPress} testID='directory-item' /> |
| 23 | +); |
| 24 | + |
| 25 | +export const WithRightLabel = () => ( |
| 26 | + <DirectoryItem |
| 27 | + title='General' |
| 28 | + description='Room with label' |
| 29 | + avatar='G' |
| 30 | + type='c' |
| 31 | + rightLabel='123 members' |
| 32 | + onPress={onPress} |
| 33 | + testID='directory-item-label' |
| 34 | + /> |
| 35 | +); |
| 36 | + |
| 37 | +export const LongRoomName = () => ( |
| 38 | + <DirectoryItem |
| 39 | + title='This is a very very very very very very very long room name that should be truncated' |
| 40 | + description='Long name test' |
| 41 | + avatar='L' |
| 42 | + type='c' |
| 43 | + rightLabel='9999 members' |
| 44 | + onPress={onPress} |
| 45 | + testID='directory-item-long' |
| 46 | + /> |
| 47 | +); |
| 48 | + |
| 49 | +export const WithoutDescription = () => ( |
| 50 | + <DirectoryItem title='No description room' avatar='N' type='c' onPress={onPress} testID='directory-item-no-desc' /> |
| 51 | +); |
| 52 | + |
| 53 | +export const DirectMessage = () => ( |
| 54 | + <DirectoryItem |
| 55 | + title='Alice Johnson' |
| 56 | + description='Hey there!' |
| 57 | + avatar='A' |
| 58 | + type='d' |
| 59 | + onPress={onPress} |
| 60 | + testID='directory-item-dm' |
| 61 | + /> |
| 62 | +); |
| 63 | + |
| 64 | +export const TeamMain = () => ( |
| 65 | + <DirectoryItem |
| 66 | + title='Engineering Team' |
| 67 | + description='Main team room' |
| 68 | + avatar='E' |
| 69 | + type='c' |
| 70 | + teamMain |
| 71 | + onPress={onPress} |
| 72 | + testID='directory-item-team' |
| 73 | + /> |
| 74 | +); |
| 75 | + |
| 76 | +export const OnlyTitle = () => <DirectoryItem title='Just a title' type='c' onPress={onPress} testID='directory-item-title' />; |
| 77 | + |
| 78 | +export const CustomStyle = () => ( |
| 79 | + <DirectoryItem |
| 80 | + title='Styled Room' |
| 81 | + description='Custom style applied' |
| 82 | + avatar='S' |
| 83 | + type='c' |
| 84 | + style={{ backgroundColor: '#e0e0e0' }} |
| 85 | + onPress={onPress} |
| 86 | + testID='directory-item-style' |
| 87 | + /> |
| 88 | +); |
0 commit comments