Skip to content

Commit 1576028

Browse files
committed
Add visual tests for the task component and visual tweaks to the Task component
1 parent ac77446 commit 1576028

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

src/components/Task.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Box,
99
VisuallyHidden,
1010
} from '@chakra-ui/react';
11-
import { BellIcon } from '@chakra-ui/icons';
11+
import { StarIcon } from '@chakra-ui/icons';
1212

1313
export const Task = ({
1414
task: { id, title, state },
@@ -47,8 +47,7 @@ export const Task = ({
4747
flex="1 1 auto"
4848
color={state === 'TASK_ARCHIVED' ? 'gray.400' : 'gray.700'}
4949
textDecoration={state === 'TASK_ARCHIVED' ? 'line-through' : 'none'}
50-
fontSize="md"
51-
fontWeight="bold"
50+
fontSize="sm"
5251
isTruncated
5352
value={title}
5453
onChange={(e) => onEditTitle(e.target.value, id)}
@@ -59,7 +58,7 @@ export const Task = ({
5958
flex="none"
6059
aria-label={state === 'TASK_PINNED' ? 'unpin' : 'pin'}
6160
variant={state === 'TASK_PINNED' ? 'unpin' : 'pin'}
62-
icon={<BellIcon />}
61+
icon={<StarIcon />}
6362
onClick={() => onTogglePinTask(state, id)}
6463
/>
6564
</Flex>

src/components/Task.stories.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from 'react';
2+
import { Task } from './Task';
3+
4+
export default {
5+
component: Task,
6+
title: 'Task',
7+
argTypes: {
8+
onArchiveTask: { action: 'onArchiveTask' },
9+
onTogglePinTask: { action: 'onTogglePinTask' },
10+
onEditTitle: { action: 'onEditTitle' },
11+
},
12+
};
13+
14+
const Template = (args) => <Task {...args} />;
15+
16+
export const Default = Template.bind({});
17+
Default.args = {
18+
task: {
19+
id: '1',
20+
title: 'Buy milk',
21+
state: 'TASK_INBOX',
22+
},
23+
};
24+
25+
export const Pinned = Template.bind({});
26+
Pinned.args = {
27+
task: {
28+
id: '2',
29+
title: 'QA dropdown',
30+
state: 'TASK_PINNED',
31+
},
32+
};
33+
34+
export const Archived = Template.bind({});
35+
Archived.args = {
36+
task: {
37+
id: '3',
38+
title: 'Write schema for account menu',
39+
state: 'TASK_ARCHIVED',
40+
},
41+
};
42+
43+
const longTitleString = `This task's name is absurdly large. In fact, I think if I keep going I might end up with content overflow. What will happen? The star that represents a pinned task could have text overlapping. The text could cut-off abruptly when it reaches the star. I hope not!`;
44+
45+
export const LongTitle = Template.bind({});
46+
LongTitle.args = {
47+
task: {
48+
id: '4',
49+
title: longTitleString,
50+
state: 'TASK_INBOX',
51+
},
52+
};

0 commit comments

Comments
 (0)