-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new library
@gravity-ui/graph
(#290)
- Loading branch information
Showing
29 changed files
with
1,892 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"goToLibrary": "Go to library", | ||
"title": "Playground" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"goToLibrary": "К библиотеке", | ||
"title": "Редактор" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
@use '~@gravity-ui/page-constructor/styles/variables.scss' as pcVariables; | ||
@use '~@gravity-ui/uikit/styles/mixins' as ukitMixins; | ||
@use '../../variables.scss'; | ||
|
||
$block: '.#{variables.$ns}graph'; | ||
|
||
#{$block} { | ||
min-height: 100%; | ||
height: 100%; | ||
margin-block-start: calc(var(--g-spacing-base) * 8); | ||
|
||
&__container { | ||
min-height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
&__heading { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-bottom: pcVariables.$indentXS; | ||
|
||
@media (max-width: map-get(pcVariables.$gridBreakpoints, 'md') - 1) { | ||
margin-bottom: pcVariables.$indentXXXS; | ||
} | ||
} | ||
|
||
&__title { | ||
font-size: 48px; | ||
line-height: 56px; | ||
font-weight: 600; | ||
color: #fff; | ||
margin: 0; | ||
|
||
@media (max-width: map-get(pcVariables.$gridBreakpoints, 'md') - 1) { | ||
font-size: 32px; | ||
line-height: 48px; | ||
margin-bottom: pcVariables.$indentXXXS; | ||
} | ||
} | ||
|
||
&__content { | ||
width: 100%; | ||
min-height: 300px; | ||
} | ||
|
||
&__playground { | ||
padding: 24px 32px; | ||
background: rgba(37, 27, 37, 1); | ||
border-radius: 24px; | ||
flex: 1; | ||
flex-direction: column; | ||
min-height: 80vh; | ||
max-height: 80vh; | ||
gap: 24px; | ||
position: relative; | ||
} | ||
|
||
&__graph-viewer { | ||
flex: 1; | ||
min-height: 100%; | ||
} | ||
|
||
&__json-switcher { | ||
position: absolute; | ||
top: 24px; | ||
right: 32px; | ||
z-index: 2; | ||
} | ||
|
||
&__editor-wrap { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 24px; | ||
} | ||
|
||
&__editor { | ||
flex: 1; | ||
border-radius: 24px; | ||
border: 1px solid rgba(255, 255, 255, 0.2); | ||
} | ||
} |
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 {Col, Grid, Row} from '@gravity-ui/page-constructor'; | ||
import {Button, ThemeProvider} from '@gravity-ui/uikit'; | ||
import {useTranslation} from 'next-i18next'; | ||
|
||
import {block, getLocaleLink} from '../../utils'; | ||
|
||
import './GraphPlayground.scss'; | ||
import {GraphPlayground} from './Playground/GraphPlayground'; | ||
|
||
const b = block('graph'); | ||
|
||
export const GraphPlayround = () => { | ||
const {t, i18n} = useTranslation('graph'); | ||
|
||
return ( | ||
<Grid className={b()} containerClass={b('container')}> | ||
<Row className={b('title')}> | ||
<Col sizes={12} className={b('heading')}> | ||
<h1 className={b('title')}>{t('title')}</h1> | ||
<div className={b('actions')}> | ||
<Button | ||
href={getLocaleLink('/libraries/graph', i18n)} | ||
className={b('library-button')} | ||
size="xl" | ||
view="outlined-contrast" | ||
> | ||
{t('goToLibrary')} | ||
</Button> | ||
</div> | ||
</Col> | ||
</Row> | ||
<Row className={b('playground')}> | ||
<ThemeProvider theme="dark"> | ||
<GraphPlayground className={b('graph-viewer')} /> | ||
</ThemeProvider> | ||
</Row> | ||
</Grid> | ||
); | ||
}; |
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; | ||
} | ||
} |
Oops, something went wrong.