Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-155
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-155
2021-155
Commits
7688940a
Commit
7688940a
authored
Jun 27, 2021
by
dasunx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
similar question suggestions model added
parent
2d0f5a5e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
175 additions
and
1 deletion
+175
-1
client/components/question-ask-view/question-form/index.js
client/components/question-ask-view/question-form/index.js
+8
-0
client/components/similar-question-suggestions/index.js
client/components/similar-question-suggestions/index.js
+60
-0
client/components/similar-question-suggestions/similar-question-suggestions.module.css
...stion-suggestions/similar-question-suggestions.module.css
+11
-0
client/components/similar-question-suggestions/similar-question/index.js
...ts/similar-question-suggestions/similar-question/index.js
+36
-0
client/components/similar-question-suggestions/similar-question/similar-question.module.css
...-suggestions/similar-question/similar-question.module.css
+24
-0
client/components/styled-text-spans/index.js
client/components/styled-text-spans/index.js
+18
-0
client/components/styled-text-spans/styled-text-spans.module.css
...components/styled-text-spans/styled-text-spans.module.css
+16
-0
client/styles/variables.css
client/styles/variables.css
+2
-1
No files found.
client/components/question-ask-view/question-form/index.js
View file @
7688940a
...
...
@@ -9,6 +9,7 @@ import Button from '../../button'
import
Textarea
from
'
../../textarea
'
import
FormInput
from
'
../../form-input
'
import
TagInput
from
'
../../tag-input
'
import
SimilarQuestionSuggestions
from
'
../../similar-question-suggestions
'
import
styles
from
'
./question-form.module.css
'
...
...
@@ -109,6 +110,13 @@ const QuestionForm = () => {
<
/Button
>
<
/div
>
<
/div
>
{
values
.
title
&&
(
<
SimilarQuestionSuggestions
title
=
{
values
.
title
}
tags
=
{
values
.
tags
}
description
=
{
values
.
text
}
/
>
)}
<
/form
>
)}
<
/Formik
>
...
...
client/components/similar-question-suggestions/index.js
0 → 100644
View file @
7688940a
import
React
,
{
useEffect
,
useState
}
from
'
react
'
import
SimilarQuestion
from
'
./similar-question
'
import
{
Title
}
from
'
../styled-text-spans/index
'
import
styles
from
'
./similar-question-suggestions.module.css
'
const
SimilarQuestionSuggestions
=
({
title
,
description
,
tags
})
=>
{
const
[
similarQuestions
,
setSimilarQuestions
]
=
useState
([
{
url
:
'
https://dasunx.com
'
,
title
:
'
How to center a div element vertically
'
,
author
:
{
username
:
'
dasunx
'
,
profilePhoto
:
'
https://secure.gravatar.com/avatar/608a987a8401796f68c4d11f?s=90&d=monsterid
'
},
views
:
240
,
comments
:
12
},
{
url
:
'
https://dasunx.com
'
,
title
:
"
I can center it horizontally, but the thing is I don't know how to center it vertically.I can center it horizontally, but the thing is I don't know how to center it vertically.
"
,
author
:
{
username
:
'
dasunx
'
,
profilePhoto
:
'
https://secure.gravatar.com/avatar/608a987a8401796f68c4d11f?s=90&d=monsterid
'
},
views
:
20
,
comments
:
1
},
{
url
:
'
https://dasunx.com
'
,
title
:
'
Test question 3
'
,
author
:
{
username
:
'
dasunx
'
,
profilePhoto
:
'
https://secure.gravatar.com/avatar/608a987a8401796f68c4d11f?s=90&d=monsterid
'
},
views
:
40
,
comments
:
6
}
])
useEffect
(()
=>
{
// TODO - Fetch similar questions from backend using the title/ description
console
.
log
(
'
TITLE CHANGED
'
)
},
[])
return
(
<
div
className
=
{
styles
.
container
}
>
<
h1
>
Similar
questions
-
{
'
'
}
<
Title
title
=
{
title
}
textColor
=
"
var(--main-purple)
"
/>
<
/h1
>
{
similarQuestions
.
map
((
question
,
index
)
=>
{
return
<
SimilarQuestion
question
=
{
question
}
key
=
{
index
}
/
>
})}
<
/div
>
)
}
export
default
SimilarQuestionSuggestions
client/components/similar-question-suggestions/similar-question-suggestions.module.css
0 → 100644
View file @
7688940a
.container
{
background-color
:
var
(
--white
);
min-height
:
10vh
;
margin
:
2em
0
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,
0.05
),
0
1px
4px
rgba
(
0
,
0
,
0
,
0.05
),
0
2px
8px
rgba
(
0
,
0
,
0
,
0.05
);
padding
:
16px
;
display
:
flex
;
flex-direction
:
column
;
max-width
:
950px
;
}
client/components/similar-question-suggestions/similar-question/index.js
0 → 100644
View file @
7688940a
import
Link
from
'
next/link
'
import
React
from
'
react
'
import
{
Bold
,
Title
}
from
'
../../styled-text-spans/index
'
import
styles
from
'
./similar-question.module.css
'
const
SimilarQuestion
=
({
question
})
=>
{
const
{
title
,
author
,
url
,
views
,
comments
}
=
question
return
(
<
Link
href
=
"
/questions/[slug]
"
as
=
{
`/questions/6087be20b0c06a179059dfa8-how-to-center-a-div-element-vertically`
}
>
<
div
className
=
{
styles
.
similarquestion
}
>
<
Link
href
=
"
/users/[user]
"
as
=
{
`/users/
${
author
.
username
}
`
}
>
<
div
className
=
{
styles
.
userwrapper
}
>
<
img
className
=
{
styles
.
profilephoto
}
src
=
{
author
.
profilePhoto
}
alt
=
{
author
.
username
}
/
>
<
Bold
text
=
{
`@
${
author
.
username
}
`
}
/
>
<
/div
>
<
/Link
>
<
div
className
=
{
styles
.
questionwrapper
}
>
<
Title
title
=
{
title
}
/
>
<
div
>
<
Bold
text
=
{
views
}
/> Views and <Bold text={comments} /
>
Comments
<
/div
>
<
/div
>
<
/div
>
<
/Link
>
)
}
export
default
SimilarQuestion
client/components/similar-question-suggestions/similar-question/similar-question.module.css
0 → 100644
View file @
7688940a
.similarquestion
{
background-color
:
var
(
--powder-200
);
margin
:
0.5em
0
;
padding
:
0.5em
0.3em
;
display
:
flex
;
flex-direction
:
row
;
border-radius
:
5px
;
}
.userwrapper
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
cursor
:
pointer
;
}
.questionwrapper
{
display
:
flex
;
flex-direction
:
column
;
padding-left
:
10px
;
overflow
:
hidden
;
}
.profilephoto
{
max-height
:
4rem
;
}
client/components/styled-text-spans/index.js
0 → 100644
View file @
7688940a
import
React
from
'
react
'
import
styles
from
'
./styled-text-spans.module.css
'
export
const
Bold
=
({
text
})
=>
{
return
<
span
className
=
{
styles
.
bold
}
>
{
text
}
<
/span
>
}
export
const
Italic
=
({
text
})
=>
{
return
<
span
className
=
{
styles
.
italic
}
>
{
text
}
<
/span
>
}
export
const
Title
=
({
title
,
textColor
})
=>
{
return
(
<
span
className
=
{
styles
.
title
}
style
=
{{
color
:
textColor
}}
>
{
title
}
<
/span
>
)
}
client/components/styled-text-spans/styled-text-spans.module.css
0 → 100644
View file @
7688940a
.bold
{
font-weight
:
600
;
}
.italic
{
font-style
:
italic
;
}
.title
{
font-weight
:
600
;
font-size
:
1.2rem
;
min-width
:
98%
;
white-space
:
nowrap
;
overflow
:
hidden
!important
;
text-overflow
:
ellipsis
;
}
client/styles/variables.css
View file @
7688940a
...
...
@@ -28,6 +28,7 @@
--powder-600
:
#5b8db1
;
--powder-700
:
#39739d
;
--powder-800
:
#2c5777
;
--main-purple
:
#800080
;
--fade
:
120ms
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment