Skip to content

Commit 7ab5b11

Browse files
committed
Style updates.
1 parent c6e4362 commit 7ab5b11

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

frontend/src/pages/chat/Chat.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
flex-direction: column;
2222
align-items: center;
2323
background: radial-gradient(108.78% 108.78% at 50.02% 19.78%, #ffffff 57.29%, #eef6fe 100%);
24-
box-shadow:
24+
/* box-shadow:
2525
0px 2px 4px rgba(0, 0, 0, 0.14),
26-
0px 0px 2px rgba(0, 0, 0, 0.12);
26+
0px 0px 2px rgba(0, 0, 0, 0.12); */
2727
border-radius: 8px;
2828
overflow-y: auto;
2929
max-height: calc(100vh - 100px);

frontend/src/pages/draft/Draft.module.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,16 @@
66
background-color: #FAF9F8;
77
padding: 2rem 2rem;
88
overflow-y: auto;
9-
}
9+
}
10+
11+
.exportDocumentIcon {
12+
box-sizing: border-box;
13+
display: flex;
14+
justify-content: center;
15+
width: 180px;
16+
height: 40px;
17+
color: #ffffff;
18+
border-radius: 4px;
19+
z-index: 1;
20+
align-self: center;
21+
}

frontend/src/pages/draft/Draft.tsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ import styles from './Draft.module.css'
33
import { useLocation } from 'react-router-dom';
44
import TitleCard from '../../components/DraftCards/TitleCard'
55
import SectionCard from '../../components/DraftCards/SectionCard'
6-
import { DraftedDocument } from '../../api'
76
import { Document, Packer, Paragraph, TextRun } from 'docx';
87
import { saveAs } from 'file-saver';
98
import { AppStateContext } from "../../state/AppProvider";
9+
import { CommandBarButton, Stack } from '@fluentui/react';
1010

1111

1212
const Draft = (): JSX.Element => {
1313
const appStateContext = useContext(AppStateContext)
1414
const location = useLocation();
15-
const { generateContentOnLoad } = location.state as { generateContentOnLoad: Boolean };
1615
const [title, setTitle] = useState('');
1716

1817
// get draftedDocument from context
@@ -65,23 +64,51 @@ const Draft = (): JSX.Element => {
6564
});
6665

6766
Packer.toBlob(doc).then(blob => {
68-
saveAs(blob, `DraftTemplate-${title}.docx`);
67+
saveAs(blob, `DraftTemplate-${sanitizeTitle(title)}.docx`);
6968
});
7069
};
7170

7271
const handleTitleChange = (newTitle: string) => {
7372
setTitle(newTitle);
7473
};
7574

75+
function sanitizeTitle(title: string): string {
76+
return title.replace(/[^a-zA-Z0-9]/g, '');
77+
}
78+
7679
return (
7780
<div className={styles.container}>
7881
<div style={{ display: 'flex', justifyContent: 'start', alignItems: 'center' }}>
7982
<h4>Draft Document</h4>
80-
<button onClick={exportToWord} style={{ marginLeft: 'auto' }}>Export to Word</button>
8183
</div>
8284

8385
<TitleCard onTitleChange={handleTitleChange} />
8486
{(sections ?? []).map((_, index) => (<SectionCard key={index} sectionIdx={index} />))}
87+
<Stack>
88+
<CommandBarButton
89+
role="button"
90+
styles={{
91+
icon: {
92+
color: '#FFFFFF'
93+
},
94+
iconDisabled: {
95+
color: '#BDBDBD !important'
96+
},
97+
root: {
98+
color: '#FFFFFF',
99+
background: '#1367CF'
100+
},
101+
rootDisabled: {
102+
background: '#F0F0F0'
103+
}
104+
}}
105+
className={styles.exportDocumentIcon}
106+
iconProps={{ iconName: 'WordDocument' }}
107+
onClick={exportToWord} //Update for Document Generation
108+
aria-label="export document"
109+
text="Export Document"
110+
/>
111+
</Stack>
85112
</div>
86113
)
87114
}

0 commit comments

Comments
 (0)