Skip to content

Commit

Permalink
Feat styles for json viewer (#131)
Browse files Browse the repository at this point in the history
* feat: new visual styles for the json view component

* feat: refined styles
  • Loading branch information
massi-ang authored Oct 23, 2023
1 parent e2e255b commit 8deaf4c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { JsonView, darkStyles } from "react-json-view-lite";
import ReactMarkdown from "react-markdown";
import { Dispatch } from "react";
import "react-json-view-lite/dist/index.css";
import "../../styles/app.scss";

export interface ChatMessageProps {
message: ChatBotHistoryItem;
Expand All @@ -31,7 +32,17 @@ export default function ChatMessage(props: ChatMessageProps) {
props.message.metadata &&
props.configuration.showMetadata && (
<ExpandableSection variant="footer" headerText="Metadata">
<JsonView data={props.message.metadata} style={darkStyles} />
<JsonView
data={props.message.metadata}
style={{
...darkStyles,
stringValue: "jsonStrings",
numberValue: "jsonNumbers",
booleanValue: "jsonBool",
nullValue: "jsonNull",
container: "jsonContainer",
}}
/>
</ExpandableSection>
)
}
Expand Down
25 changes: 25 additions & 0 deletions lib/user-interface/react-app/src/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,28 @@ body.awsui-dark-mode {
}
}
}

.jsonContainer {
font-family: "Open Sans", sans-serif;
font-size: 1em;
background-color: #0e1b2ac3;
}

.jsonStrings {
color: rgb(74, 234, 167);

}

.jsonNumbers {
color: rgb(255, 223, 60);
}

.jsonBool {
color: rgb(252, 178, 250);
font-weight: 600;
}

.jsonNull {
color:rgb(74, 205, 234);
font-weight: 600;
}

0 comments on commit 8deaf4c

Please sign in to comment.