Skip to content

Commit b06436c

Browse files
committed
fix: use primary color for buttons
markdown editor also to follow the styling of theme fixes #37
1 parent eee738f commit b06436c

File tree

10 files changed

+53
-8
lines changed

10 files changed

+53
-8
lines changed

plugins/qeta/src/components/AskForm/AskForm.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Button, TextField } from '@material-ui/core';
33
import { Alert, Autocomplete } from '@material-ui/lab';
44
import React, { useEffect } from 'react';
55
import { Controller, useForm } from 'react-hook-form';
6-
import 'react-mde/lib/styles/css/react-mde-all.css';
76
import { useNavigate, useSearchParams } from 'react-router-dom';
87
import {
98
QetaApi,
@@ -300,7 +299,12 @@ export const AskForm = (props: {
300299
name="entities"
301300
/>
302301
)}
303-
<Button type="submit" variant="contained" className={styles.postButton}>
302+
<Button
303+
color="primary"
304+
type="submit"
305+
variant="contained"
306+
className={styles.postButton}
307+
>
304308
{id ? 'Save' : 'Post'}
305309
</Button>
306310
</form>

plugins/qeta/src/components/AskPage/AskPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Content, ContentHeader, InfoCard } from '@backstage/core-components';
22
import { Button, Grid } from '@material-ui/core';
33
import React from 'react';
4-
import 'react-mde/lib/styles/css/react-mde-all.css';
4+
55
import { AskForm } from '../AskForm/AskForm';
66
import HomeOutlined from '@material-ui/icons/HomeOutlined';
77
import { useParams } from 'react-router-dom';

plugins/qeta/src/components/HomePage/HomePage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export const HomePageContent = () => {
111111
<Button
112112
variant="contained"
113113
href="/qeta/ask"
114+
color="primary"
114115
startIcon={<HelpOutline />}
115116
>
116117
Ask question

plugins/qeta/src/components/MarkdownEditor/MarkdownEditor.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from 'react';
22
import ReactMde from 'react-mde';
33
import { MarkdownContent } from '@backstage/core-components';
4+
import 'react-mde/lib/styles/css/react-mde.css';
5+
import 'react-mde/lib/styles/css/react-mde-editor.css';
6+
import 'react-mde/lib/styles/css/react-mde-toolbar.css';
47
import { useStyles } from '../../utils/hooks';
58

69
export const MarkdownEditor = (props: {
@@ -27,10 +30,21 @@ export const MarkdownEditor = (props: {
2730
selectedTab={selectedTab}
2831
onTabChange={setSelectedTab}
2932
minEditorHeight={height}
30-
minPreviewHeight={height}
31-
childProps={{ textArea: { required: true, placeholder } }}
33+
minPreviewHeight={height - 10}
34+
childProps={{
35+
textArea: {
36+
required: true,
37+
placeholder,
38+
},
39+
}}
3240
generateMarkdownPreview={content =>
33-
Promise.resolve(<MarkdownContent content={content} />)
41+
Promise.resolve(
42+
<MarkdownContent
43+
content={content}
44+
dialect="gfm"
45+
className={styles.markdownContent}
46+
/>,
47+
)
3448
}
3549
/>
3650
);

plugins/qeta/src/components/QuestionPage/AnswerCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const AnswerCard = (props: {
5454
<>
5555
<Typography variant="body1" gutterBottom>
5656
<MarkdownContent
57+
className={styles.markdownContent}
5758
content={answerEntity.content}
5859
dialect="gfm"
5960
/>

plugins/qeta/src/components/QuestionPage/AnswerForm.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ export const AnswerForm = (props: {
102102
)}
103103
name="answer"
104104
/>
105-
<Button variant="contained" type="submit" className={styles.postButton}>
105+
<Button
106+
variant="outlined"
107+
type="submit"
108+
color="primary"
109+
className={styles.postButton}
110+
>
106111
{id ? 'Save' : 'Post'}
107112
</Button>
108113
</form>

plugins/qeta/src/components/QuestionPage/QuestionCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ export const QuestionCard = (props: { question: QuestionResponse }) => {
6464
</div>
6565
<div className={styles.questionCardContent}>
6666
<Typography variant="body1" gutterBottom>
67-
<MarkdownContent content={question.content} dialect="gfm" />
67+
<MarkdownContent
68+
content={question.content}
69+
dialect="gfm"
70+
className={styles.markdownContent}
71+
/>
6872
</Typography>
6973
<Box className={styles.questionCardMetadata}>
7074
<Grid container spacing={0} justifyContent="space-around">

plugins/qeta/src/components/QuestionPage/QuestionPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const QuestionPage = () => {
8484
<Button
8585
variant="contained"
8686
href="/qeta/ask"
87+
color="primary"
8788
startIcon={<HelpOutline />}
8889
>
8990
Ask question

plugins/qeta/src/components/QuestionsContainer/QuestionList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export const QuestionList = (props: {
7878
<Button
7979
href={entity ? `/qeta/ask?entity=${entity}` : '/qeta/ask'}
8080
startIcon={<HelpOutline />}
81+
color="primary"
82+
variant="outlined"
8183
>
8284
Go ahead and ask one!
8385
</Button>

plugins/qeta/src/utils/hooks.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ export const useStyles = makeStyles(theme => {
6363
color: `${theme.palette.text.primary} !important`,
6464
},
6565
},
66+
'& .mde-preview-content': {
67+
padding: '0 10px 0px 10px',
68+
},
69+
'& .mde-text, .mde-preview': {
70+
fontSize: theme.typography.body1.fontSize,
71+
fontFamily: theme.typography.body1.fontFamily,
72+
lineHeight: theme.typography.body1.lineHeight,
73+
},
6674
'& .mde-text': {
6775
backgroundColor: 'initial',
6876
color: theme.palette.text.primary,
@@ -72,6 +80,11 @@ export const useStyles = makeStyles(theme => {
7280
markdownEditorError: {
7381
border: `1px solid ${theme.palette.error.main} !important`,
7482
},
83+
markdownContent: {
84+
'& h1, h2, h3, h4, h5, h6': {
85+
marginTop: 0,
86+
},
87+
},
7588
successColor: {
7689
color: theme.palette.success.main,
7790
},

0 commit comments

Comments
 (0)