Skip to content

Commit

Permalink
#16 Add icon example to the nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
vidhya-metacell committed Jul 30, 2022
1 parent 9545f85 commit b58c1b6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
Binary file added example/components/assets/svg/node/blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/components/assets/svg/node/gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/components/assets/svg/node/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion example/components/widgets/CustomNodeWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class CustomNodeWidget extends React.Component<CustomNodeWidgetProps> {
)}

<Box className="primary-node_header">
<img src="" alt={this.props.model.getOptions()['name']} />
<Box className="icon" />

<Typography component="p">
{this.props.model.getOptions()['name']}
Expand Down
15 changes: 15 additions & 0 deletions example/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import vars from './components/assets/styles/variables';
import { createTheme } from '@mui/material/styles';
import nodeBlue from "./components/assets/svg/node/blue.png";
import nodeGray from "./components/assets/svg/node/gray.png";
import nodeRed from './components/assets/svg/node/red.png';

const {
nodeRedBackgroundColor,
Expand Down Expand Up @@ -38,6 +41,10 @@ const theme = {
border-color: ${nodeRedBorderColor};
}
.primary-node.node-red .icon {
background: url(${nodeRed});
}
.primary-node.node-red .primary-node_header p {
color: ${nodeRedTextColor};
}
Expand All @@ -53,6 +60,10 @@ const theme = {
border-color: ${nodeBlueBorderColor};
}
.primary-node.node-blue .icon {
background: url(${nodeBlue});
}
.primary-node.node-blue .primary-node_header p {
color: ${nodeBlueTextColor};
}
Expand All @@ -68,6 +79,10 @@ const theme = {
border-color: ${nodeGrayBorderColor};
}
.primary-node.node-gray .icon {
background: url(${nodeGray});
}
.primary-node.node-gray .primary-node_header p {
color: ${nodeGrayTextColor};
}
Expand Down
4 changes: 3 additions & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const applicationTheme = (params: ThemeVars) => {
width: 20px;
height: 20px;
margin: 0 auto 0.25rem;
background: url(data:image/svg+xml;base64,${new Buffer(nodeGreen).toString('base64')});
background: url(data:image/svg+xml;base64,${new Buffer(
nodeGreen
).toString('base64')});
}
.primary-node .primary-node_header p {
Expand Down

0 comments on commit b58c1b6

Please sign in to comment.