-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shared-data, components): add OT-3 deckmap component (#11543)
* feat(shared-data, components): add OT-3 deckmap component RCORE-250
- Loading branch information
Showing
9 changed files
with
3,628 additions
and
1,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
import * as React from 'react' | ||
import cx from 'classnames' | ||
import map from 'lodash/map' | ||
import snakeCase from 'lodash/snakeCase' | ||
import parseHtml from 'html-react-parser' | ||
import { stringify } from 'svgson' | ||
|
||
import styles from './Deck.css' | ||
|
||
import type { | ||
DeckDefinition, | ||
DeckLayer, | ||
DeckLayerFeature, | ||
} from '@opentrons/shared-data' | ||
import type { DeckDefinition } from '@opentrons/shared-data' | ||
|
||
export interface DeckFromDataProps { | ||
def: DeckDefinition | ||
layerBlocklist: string[] | ||
} | ||
|
||
export function DeckFromData(props: DeckFromDataProps): JSX.Element { | ||
const { def, layerBlocklist } = props | ||
const { def, layerBlocklist = [] } = props | ||
|
||
const layerGroupNodes = def.layers.filter( | ||
g => !layerBlocklist.includes(g.attributes?.id) | ||
) | ||
|
||
const groupNodeWrapper = { | ||
name: 'g', | ||
type: 'element', | ||
value: '', | ||
attributes: { id: 'deckLayers' }, | ||
children: layerGroupNodes, | ||
} | ||
|
||
return ( | ||
<g> | ||
{map(def.layers, (layer: DeckLayer, layerId: string) => { | ||
if (layerBlocklist.includes(layerId)) return null | ||
return ( | ||
<g id={layerId} key={layerId}> | ||
<path | ||
className={cx( | ||
styles.deck_outline, | ||
styles[def.otId], | ||
styles[snakeCase(layerId)] | ||
)} | ||
d={layer.map((l: DeckLayerFeature) => l.footprint).join(' ')} | ||
/> | ||
</g> | ||
) | ||
})} | ||
{parseHtml( | ||
stringify(groupNodeWrapper, { | ||
selfClose: false, | ||
}) | ||
)} | ||
</g> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
3,216 changes: 2,954 additions & 262 deletions
3,216
shared-data/deck/definitions/3/ot3_standard.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters