diff options
Diffstat (limited to 'app/components')
-rw-r--r-- | app/components/graph/3d.tsx | 62 | ||||
-rw-r--r-- | app/components/local/local.story.tsx | 15 | ||||
-rw-r--r-- | app/components/local/local.tsx | 37 |
3 files changed, 52 insertions, 62 deletions
diff --git a/app/components/graph/3d.tsx b/app/components/graph/3d.tsx deleted file mode 100644 index a539d8c..0000000 --- a/app/components/graph/3d.tsx +++ /dev/null @@ -1,62 +0,0 @@ - - ref={fgRef} - //graphData={!physics.local ? gData : localGraphData } - graphData={gData} - nodeAutoColorBy={physics.colorful ? "id" : undefined} - nodeColor={ - !physics.colorful - ? (node) => { - if (highlightNodes.size === 0) { - return "rgb(100, 100, 100, 1)" - } else { - return highlightNodes.has(node) ? "purple" : "rgb(50, 50, 50, 0.5)" - } - } - : undefined - } - linkAutoColorBy={physics.colorful ? "target" : undefined} - //linkAutoColorBy={(d) => gData.nodes[d.source].id % GROUPS} - linkColor={ - !physics.colorful - ? (link) => { - if (highlightLinks.size === 0) { - return "rgb(50, 50, 50, 0.8)" - } else { - return highlightLinks.has(link) ? "purple" : "rgb(50, 50, 50, 0.2)" - } - } - : undefined - } - linkDirectionalParticles={physics.particles} - nodeLabel={(node) => node.title} - linkWidth={(link) => - highlightLinks.has(link) ? 3 * physics.linkWidth : physics.linkWidth - } - linkOpacity={physics.linkOpacity} - nodeRelSize={physics.nodeRel} - nodeVal={(node) => - highlightNodes.has(node) ? node.neighbors.length + 5 : node.neighbors.length + 3 - } - linkDirectionalParticleWidth={physics.particleWidth} - onNodeHover={physics.hover ? handleNodeHover : null} - d3AlphaDecay={physics.alphaDecay} - d3AlphaMin={physics.alphaTarget} - d3VelocityDecay={physics.velocityDecay} - nodeThreeObject={ - !physics.labels - ? undefined - : (node) => { - if (highlightNodes.has(node)) { - console.log(node.title) - const sprite = new SpriteText(node.title.substring(0, 30)) - console.log("didnt crash here 2") - sprite.color = "#ffffff" - sprite.textHeight = 8 - return sprite - } else { - return undefined - } - } - } - nodeThreeObjectExtend={true} - onNodeClick={selectClick} diff --git a/app/components/local/local.story.tsx b/app/components/local/local.story.tsx new file mode 100644 index 0000000..b161f0e --- /dev/null +++ b/app/components/local/local.story.tsx @@ -0,0 +1,15 @@ +import * as React from "react" +import { storiesOf } from "@storybook/react-native" +import { StoryScreen, Story, UseCase } from "../../../storybook/views" +import { color } from "../../theme" +import { Local } from "./local" + +storiesOf("Local", module) + .addDecorator((fn) => <StoryScreen>{fn()}</StoryScreen>) + .add("Style Presets", () => ( + <Story> + <UseCase text="Primary" usage="The primary."> + <Local style={{ backgroundColor: color.error }} /> + </UseCase> + </Story> + )) diff --git a/app/components/local/local.tsx b/app/components/local/local.tsx new file mode 100644 index 0000000..82ea0ee --- /dev/null +++ b/app/components/local/local.tsx @@ -0,0 +1,37 @@ +import * as React from "react" +import { StyleProp, TextStyle, View, ViewStyle } from "react-native" +import { observer } from "mobx-react-lite" +import { color, typography } from "../../theme" +import { Text } from "../" +import { flatten } from "ramda" + +const CONTAINER: ViewStyle = { + justifyContent: "center", +} + +const TEXT: TextStyle = { + fontFamily: typography.primary, + fontSize: 14, + color: color.primary, +} + +export interface LocalProps { + /** + * An optional style override useful for padding & margin. + */ + style?: StyleProp<ViewStyle> +} + +/** + * Describe your component here + */ +export const Local = observer(function Local(props: LocalProps) { + const { style } = props + const styles = flatten([CONTAINER, style]) + + return ( + <View style={styles}> + <Text style={TEXT}>Hello</Text> + </View> + ) +}) |