Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC] Add support of custom GraphQL scalars #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 48 additions & 28 deletions src/Explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,34 +737,54 @@ class AbstractArgView extends React.PureComponent<AbstractArgViewProps, {}> {
</span>
);
} else if (isScalarType(argType)) {
if (argType.name === 'Boolean') {
input = (
<select
style={{
color: styleConfig.colors.builtin,
}}
onChange={this.props.setArgValue}
value={
argValue.kind === 'BooleanValue' ? argValue.value : undefined
}>
<option key="true" value="true">
true
</option>
<option key="false" value="false">
false
</option>
</select>
);
} else {
input = (
<ScalarInput
setArgValue={this.props.setArgValue}
arg={arg}
argValue={argValue}
onRunOperation={this.props.onRunOperation}
styleConfig={this.props.styleConfig}
/>
);
switch (argType.name) {
case 'Boolean':
input = (
<select
style={{
color: styleConfig.colors.builtin,
}}
onChange={this.props.setArgValue}
value={
argValue.kind === 'BooleanValue' ? argValue.value : undefined
}>
<option key="true" value="true">
true
</option>
<option key="false" value="false">
false
</option>
</select>
);
break;
case 'HexColorCode':
input = (
<input
type="color"
value={argValue.value}
onChange={this.props.setArgValue}
/>
);
break;
case 'Date':
input = (
<input
type="date"
value={argValue.value}
onChange={this.props.setArgValue}
/>
);
break;
default:
input = (
<ScalarInput
setArgValue={this.props.setArgValue}
arg={arg}
argValue={argValue}
onRunOperation={this.props.onRunOperation}
styleConfig={this.props.styleConfig}
/>
);
}
} else if (isEnumType(argType)) {
if (argValue.kind === 'EnumValue') {
Expand Down