-
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
25 changed files
with
1,755 additions
and
27 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
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
26 changes: 26 additions & 0 deletions
26
src/components/GraphPlayground/Playground/ActionBlock/ActionBlock.scss
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,26 @@ | ||
@use '~@gravity-ui/page-constructor/styles/variables.scss' as pcVariables; | ||
@use '~@gravity-ui/uikit/styles/mixins' as ukitMixins; | ||
@use '../../../../variables.scss'; | ||
|
||
$block: '.#{variables.$ns}block'; | ||
|
||
#{$block} { | ||
border-radius: 8px; | ||
border-width: 2px; | ||
padding: var(--g-spacing-3); | ||
|
||
display: flex; | ||
flex-direction: column; | ||
gap: var(--g-spacing-1); | ||
|
||
&:hover { | ||
&:not(.selected) { | ||
border-color: rgba(229, 229, 229, 0.4); | ||
} | ||
background-color: rgba(57, 47, 57, 1); | ||
} | ||
|
||
&__name { | ||
font-weight: 500; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
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,41 @@ | ||
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 {block} from '../../../../utils'; | ||
import {TGravityActionBlock} from '../generateLayout'; | ||
|
||
import './ActionBlock.scss'; | ||
|
||
const b = block('block'); | ||
|
||
export function ActionBlockHtml({graph, block}: {graph: Graph; block: TGravityActionBlock}) { | ||
return ( | ||
<GraphBlock graph={graph} block={block} className={b()}> | ||
{block.anchors.map((anchor) => { | ||
return ( | ||
<GraphBlockAnchor | ||
key={anchor.id} | ||
position="absolute" | ||
graph={graph} | ||
anchor={anchor} | ||
/> | ||
); | ||
})} | ||
<Flex grow={1} direction={'column'}> | ||
<Text ellipsis variant="caption-2" className={b('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.