Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ClientProject
Redoc
Commits
de27ac03
Unverified
Commit
de27ac03
authored
5 years ago
by
Oleksiy Kachynskyy
Committed by
GitHub
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
fix: update EnumValues component (#1324)
parent
676faa94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
demo/playground/hmr-playground.tsx
+1
-1
demo/playground/hmr-playground.tsx
src/components/Fields/EnumValues.tsx
+12
-2
src/components/Fields/EnumValues.tsx
with
13 additions
and
3 deletions
+13
-3
demo/playground/hmr-playground.tsx
View file @
de27ac03
...
...
@@ -26,7 +26,7 @@ const specUrl =
(
userUrl
&&
userUrl
[
1
])
||
(
swagger
?
'
swagger.yaml
'
:
big
?
'
big-openapi.json
'
:
'
openapi.yaml
'
);
let
store
;
const
options
:
RedocRawOptions
=
{
nativeScrollbars
:
false
,
maxDisplayedEnumValues
:
2
};
const
options
:
RedocRawOptions
=
{
nativeScrollbars
:
false
,
maxDisplayedEnumValues
:
3
};
async
function
init
()
{
const
spec
=
await
loadAndBundleSpec
(
specUrl
);
...
...
This diff is collapsed.
Click to expand it.
src/components/Fields/EnumValues.tsx
View file @
de27ac03
...
...
@@ -42,6 +42,16 @@ export class EnumValues extends React.PureComponent<EnumValuesProps, EnumValuesS
?
values
.
slice
(
0
,
maxDisplayedEnumValues
)
:
values
;
const
showToggleButton
=
maxDisplayedEnumValues
?
values
.
length
>
maxDisplayedEnumValues
:
false
;
const
toggleButtonText
=
maxDisplayedEnumValues
?
collapsed
?
`…
${
values
.
length
-
maxDisplayedEnumValues
}
more`
:
'
Hide
'
:
''
;
return
(
<
div
>
<
FieldLabel
>
...
...
@@ -56,13 +66,13 @@ export class EnumValues extends React.PureComponent<EnumValuesProps, EnumValuesS
</
React
.
Fragment
>
);
})
}
{
maxDisplayedEnumValues
?
(
{
showToggleButton
?
(
<
ToggleButton
onClick
=
{
()
=>
{
this
.
toggle
();
}
}
>
{
collapsed
?
`…
${
values
.
length
-
maxDisplayedEnumValues
}
more`
:
'
Hide
'
}
{
toggleButtonText
}
</
ToggleButton
>
)
:
null
}
</
div
>
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help