Skip to content

Commit

Permalink
pipelight - add support for pclass icons in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
loredanacirstea committed Mar 22, 2020
1 parent 717f2af commit 905f772
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/packages/react-pipeos-components/src/PclassList.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ export default class PclassList extends Component {
});
const btnOffset = headerButtons.length * this.buttonOffset + 110;

const itemIcons = (item.icons || []).map(icon => {
return (
<Thumbnail
source={{ uri: icon.uri }}
style={{ height: 15, width: 15, borderRadius: 5, marginLeft: 5 }}
/>
)
})

return (
<View
style={{
Expand All @@ -52,11 +61,12 @@ export default class PclassList extends Component {
}}
>

<View style={{flexDirection: 'row'}}>
<View style={{flexDirection: 'row', alignItems: 'center'}}>
{expanded
? <Icon style={{ fontSize: 18 }} name='remove-circle' />
: <Icon style={{ fontSize: 18 }} name='add-circle' />
}
{itemIcons}
<Text
style={{ fontFamily: null, fontWeight: '400', paddingLeft: 10, maxWidth: this.props.styles.minWidth - btnOffset }}
>
Expand Down
69 changes: 69 additions & 0 deletions pipelight/public/wasm_type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion pipelight/src/components/Workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ export default class Workspace extends Component {
maxHeight: props.styles.height - 36,
}

const treedataWithIcons = treedata.map(item => {
item.icons = (item.metadata.languages || item.metadata.categories).map(lang => {
return {uri: `/${lang}_type.svg`};
});
return item;
});

const tabButtons = [];
tabButtons.push((
<Button
Expand Down Expand Up @@ -119,7 +126,7 @@ export default class Workspace extends Component {
} else {
mainView = treedata.length > 0
? <PclassList
data={treedata}
data={treedataWithIcons}
buttons={contractButtons}
styles={props.styles}
buttonStyle={styles.buttonStyle}
Expand Down

0 comments on commit 905f772

Please sign in to comment.