Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
2792a606
Unverified
Commit
2792a606
authored
3 years ago
by
Shawna Monero
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
FE: core: add support for a link and location to Notes (#2102)
parent
0e9d447d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/packages/core/src/Feedback/note.tsx
+14
-2
frontend/packages/core/src/Feedback/note.tsx
frontend/packages/core/src/Feedback/stories/note-panel.stories.tsx
+10
-0
...packages/core/src/Feedback/stories/note-panel.stories.tsx
with
24 additions
and
2 deletions
+24
-2
frontend/packages/core/src/Feedback/note.tsx
+
14
-
2
View file @
2792a606
...
...
@@ -3,6 +3,8 @@ import styled from "@emotion/styled";
import
{
Grid
,
Paper
}
from
"
@material-ui/core
"
;
import
type
{
Color
}
from
"
@material-ui/lab/Alert
"
;
import
{
Link
}
from
"
../link
"
;
import
{
Alert
}
from
"
./alert
"
;
const
NotePanelContainer
=
styled
(
Grid
)({
...
...
@@ -13,10 +15,19 @@ const NotePanelContainer = styled(Grid)({
export
interface
NoteProps
{
severity
?:
Color
;
// Use this if you want to add a link after your text blob (useful for
// linking to docs or a resource described in the text blob)
link
?:
string
;
}
export
interface
NoteConfig
extends
NoteProps
{
text
:
string
;
// Use this to specify the location in regards to a wizard for the note.
// For example, you can specify it to be in the "intro" step, then in the
// intro you iterate through your notes, selectively showing the ones that are
// specified for that step. This allows users to have different notes
// for different stages of a workflow.
location
?:
string
;
}
export
interface
NotePanelProps
{
...
...
@@ -24,13 +35,14 @@ export interface NotePanelProps {
notes
?:
NoteConfig
[];
}
const
Note
:
React
.
FC
<
NoteProps
>
=
({
severity
=
"
info
"
,
children
})
=>
{
const
Note
:
React
.
FC
<
NoteProps
>
=
({
severity
=
"
info
"
,
link
=
""
,
children
})
=>
{
return
(
<
Paper
elevation
=
{
0
}
>
<
Alert
severity
=
{
severity
}
>
<
Grid
container
justify
=
"flex-start"
alignItems
=
"center"
>
{
children
}
</
Grid
>
{
link
&&
<
Link
href
=
{
link
}
>
{
link
}
</
Link
>
}
</
Alert
>
</
Paper
>
);
...
...
@@ -45,7 +57,7 @@ const NotePanel: React.FC<NotePanelProps> = ({ direction = "column", notes, chil
wrap
=
"nowrap"
>
{
notes
?.
map
((
note
:
NoteConfig
)
=>
(
<
Note
key
=
{
note
.
text
}
severity
=
{
note
.
severity
}
>
<
Note
key
=
{
note
.
text
}
severity
=
{
note
.
severity
}
link
=
{
note
.
link
}
>
{
note
.
text
}
</
Note
>
))
}
...
...
This diff is collapsed.
Click to expand it.
frontend/packages/core/src/Feedback/stories/note-panel.stories.tsx
+
10
-
0
View file @
2792a606
...
...
@@ -24,6 +24,16 @@ Primary.args = {
severity
:
"
warning
"
,
text
:
"
Warning message.
"
,
},
{
severity
:
"
info
"
,
text
:
"
Message with a link
"
,
link
:
"
https://clutch.sh/docs
"
,
},
{
severity
:
"
info
"
,
text
:
"
message with a location (only useful to developers, not visible to end users)
"
,
location
:
"
intro
"
,
},
],
};
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help