-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add playground for @gravity-ui/graph
- Loading branch information
Showing
23 changed files
with
1,689 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
21 changes: 21 additions & 0 deletions
21
src/components/GraphPlayground/Playground/ActionBlock/ActionBlock.css
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.action-block-wrapper { | ||
border-radius: 8px; | ||
border-width: 4px; | ||
padding: var(--g-spacing-3); | ||
|
||
display: flex; | ||
flex-direction: column; | ||
gap: var(--g-spacing-1); | ||
} | ||
|
||
.action-block-name { | ||
font-weight: 500; | ||
} | ||
|
||
.action-block-wrapper:hover { | ||
cursor: pointer; | ||
border-color: rgba(229, 229, 229, 0.4); | ||
background-color: rgba(57, 47, 57, 1); | ||
} | ||
|
||
|
39 changes: 39 additions & 0 deletions
39
src/components/GraphPlayground/Playground/ActionBlock/ActionBlockHtml.tsx
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {Graph, GraphBlock, GraphBlockAnchor} from '@gravity-ui/graph'; | ||
import {Database} from '@gravity-ui/icons'; | ||
import {Button, Flex, Icon, Text} from '@gravity-ui/uikit'; | ||
import React from 'react'; | ||
|
||
import {TGravityActionBlock} from '../generateLayout'; | ||
|
||
import './ActionBlock.css'; | ||
|
||
export function ActionBlockHtml({graph, block}: {graph: Graph; block: TGravityActionBlock}) { | ||
return ( | ||
<GraphBlock graph={graph} block={block} className="action-block-wrapper"> | ||
{block.anchors.map((anchor) => { | ||
return ( | ||
<GraphBlockAnchor | ||
className="action-block-achor" | ||
key={anchor.id} | ||
position="absolute" | ||
graph={graph} | ||
anchor={anchor} | ||
/> | ||
); | ||
})} | ||
<Flex grow={1} direction={'column'}> | ||
<Text ellipsis variant="caption-2" className="action-block-name"> | ||
{block.name} | ||
</Text> | ||
<Text ellipsis variant="caption-1" color="secondary"> | ||
{block.meta?.description} | ||
</Text> | ||
</Flex> | ||
<Flex> | ||
<Button onClick={(e) => e.stopPropagation()}> | ||
<Icon data={Database} /> | ||
</Button> | ||
</Flex> | ||
</GraphBlock> | ||
); | ||
} |
Oops, something went wrong.