File tree Expand file tree Collapse file tree 4 files changed +43
-25
lines changed
packages/app/src/app/pages/Sandbox/Editor/Workspace/Project Expand file tree Collapse file tree 4 files changed +43
-25
lines changed Original file line number Diff line number Diff line change 1+ import { Link as LinkBase } from 'react-router-dom' ;
2+ import styled , { css } from 'styled-components' ;
3+
4+ export const Link = styled ( LinkBase ) `
5+ ${ ( { theme } ) => css `
6+ color : ${ theme . templateColor } !important ;
7+ ` }
8+ ` ;
Original file line number Diff line number Diff line change 1+ import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name' ;
2+ import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator' ;
3+ import React , { FunctionComponent } from 'react' ;
4+
5+ import { useOvermind } from 'app/overmind' ;
6+
7+ import { Item , PropertyName , PropertyValue } from '../elements' ;
8+
9+ import { Link } from './elements' ;
10+
11+ export const ForkedFrom : FunctionComponent = ( ) => {
12+ const {
13+ state : {
14+ editor : {
15+ currentSandbox : { forkedFromSandbox, forkedTemplateSandbox } ,
16+ } ,
17+ } ,
18+ } = useOvermind ( ) ;
19+
20+ return (
21+ < Item >
22+ < PropertyName >
23+ { forkedTemplateSandbox ? 'Template' : 'Forked From' }
24+ </ PropertyName >
25+
26+ < PropertyValue >
27+ < Link to = { sandboxUrl ( forkedFromSandbox || forkedTemplateSandbox ) } >
28+ { getSandboxName ( forkedFromSandbox || forkedTemplateSandbox ) }
29+ </ Link >
30+ </ PropertyValue >
31+ </ Item >
32+ ) ;
33+ } ;
Original file line number Diff line number Diff line change 11import Question from 'react-icons/lib/go/question' ;
22import EditPenIcon from 'react-icons/lib/md/create' ;
3- import { Link } from 'react-router-dom' ;
43import styled , { css } from 'styled-components' ;
54
65export const Container = styled . div `
@@ -82,12 +81,6 @@ export const Icon = styled(Question)`
8281 cursor: pointer;
8382` ;
8483
85- export const TemplateStyledLink = styled ( Link ) `
86- ${ ( { theme } ) => css `
87- color: ${ theme . templateColor } !important;
88- ` }
89- ` ;
90-
9184export const BundlerLink = styled . a . attrs ( {
9285 target : '_blank' ,
9386 rel : 'noreferrer noopener' ,
Original file line number Diff line number Diff line change 11import Tooltip from '@codesandbox/common/lib/components/Tooltip' ;
22import getTemplateDefinition from '@codesandbox/common/lib/templates' ;
3- import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name' ;
4- import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator' ;
53import React , { FunctionComponent } from 'react' ;
64
75import { useOvermind } from 'app/overmind' ;
@@ -20,8 +18,8 @@ import {
2018 PropertyName ,
2119 PropertyValue ,
2220 StatsContainer ,
23- TemplateStyledLink ,
2421} from './elements' ;
22+ import { ForkedFrom } from './ForkedFrom' ;
2523import { Frozen } from './Frozen' ;
2624import { Git } from './Git' ;
2725import { Keywords } from './Keywords' ;
@@ -83,21 +81,7 @@ export const Project: FunctionComponent<Props> = ({ editable = false }) => {
8381
8482 { editable && < Frozen /> }
8583
86- { ( forkedFromSandbox || forkedTemplateSandbox ) && (
87- < Item >
88- < PropertyName >
89- { forkedTemplateSandbox ? 'Template' : 'Forked From' }
90- </ PropertyName >
91-
92- < PropertyValue >
93- < TemplateStyledLink
94- to = { sandboxUrl ( forkedFromSandbox || forkedTemplateSandbox ) }
95- >
96- { getSandboxName ( forkedFromSandbox || forkedTemplateSandbox ) }
97- </ TemplateStyledLink >
98- </ PropertyValue >
99- </ Item >
100- ) }
84+ { ( forkedFromSandbox || forkedTemplateSandbox ) && < ForkedFrom /> }
10185
10286 < Item >
10387 < PropertyName >
You can’t perform that action at this time.
0 commit comments