Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit a841897

Browse files
committed
Create task sticky
1 parent 6b4082c commit a841897

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
"*.{css,sass,scss}.d.ts": true
3535
},
3636

37-
"cSpell.words": ["Popconfirm"]
37+
"cSpell.words": ["Popconfirm", "Sider"]
3838
}

src/screens/projects/ProjectsScreen.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ function clearEditableProject() {
8787
projectStore.setEditableProject(undefined);
8888
}
8989

90-
export default observer(function Projects() {
91-
const classes = useStyles();
90+
function Projects() {
91+
const style = useStyles();
9292
const [showProjectModal, setShowProjectModal] = useState<boolean>(false);
9393
const [drawerVisible, setDrawerVisible] = useState<boolean>(false);
9494
const [selectedTask, setSelectedTask] = useState<TaskModel | undefined>();
@@ -115,8 +115,8 @@ export default observer(function Projects() {
115115

116116
return (
117117
<Layout>
118-
<Sider width={250} className={classes.sider}>
119-
<Layout className={classes.padding}>
118+
<Sider width={250} className={style.sider}>
119+
<Layout className={style.padding}>
120120
<Space direction="vertical">
121121
<ProjectList onSelect={handleSelectProject} />
122122
<Button onClick={handleCreateProject} icon={<PlusOutlined />}>
@@ -125,11 +125,13 @@ export default observer(function Projects() {
125125
</Space>
126126
</Layout>
127127
</Sider>
128-
<Layout className={clsx(classes.padding, classes.tasks)}>
129-
<Space className="root" direction="vertical">
128+
<Layout className={style.taskList}>
129+
<div className={style.root}>
130130
<TaskList onSelect={handleSelectTask} />
131-
<TaskInput />
132-
</Space>
131+
<div className={style.stickyTaskInput}>
132+
<TaskInput />
133+
</div>
134+
</div>
133135
</Layout>
134136
{showProjectModal && <ProjectModal onClose={handleHideProjectModal} />}
135137
<EditProjectModal
@@ -143,17 +145,32 @@ export default observer(function Projects() {
143145
/>
144146
</Layout>
145147
);
146-
});
148+
}
149+
150+
export default observer(Projects);
147151

148152
const useStyles = createUseStyles({
149153
sider: {
150154
backgroundColor: '#f0f2f5',
151155
borderRight: '1px solid #d9d9d9',
152156
},
153-
tasks: {
157+
taskList: {
154158
overflowY: 'auto',
159+
padding: '12px 12px 0 12px',
155160
},
156161
padding: {
157162
padding: 12,
158163
},
164+
root: {
165+
display: 'flex',
166+
flexDirection: 'column',
167+
flex: 1,
168+
height: '100%',
169+
},
170+
stickyTaskInput: {
171+
position: 'sticky',
172+
bottom: 0,
173+
padding: '12px 0',
174+
backgroundColor: '#f0f2f5',
175+
},
159176
});

src/screens/projects/components/TaskInput.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { v4 as uuid } from 'uuid';
66
import rootStore from '../../../modules/RootStore';
77
import TaskModel from '../../../modules/tasks/models/TaskModel';
88

9-
export default observer(function TaskInput() {
9+
interface Props {
10+
className?: string;
11+
}
12+
13+
export default observer(function TaskInput({ className }: Props) {
1014
const [text, setText] = useState('');
1115

1216
const handleKeyPress = useCallback(
@@ -39,6 +43,7 @@ export default observer(function TaskInput() {
3943

4044
return (
4145
<Input
46+
className={className}
4247
placeholder="Create task..."
4348
onKeyPress={handleKeyPress}
4449
value={text}

0 commit comments

Comments
 (0)