-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(code/frontend): enable diff page
- Loading branch information
WangQianliang
authored
Oct 21, 2019
1 parent
00c21dc
commit d5cbb47
Showing
12 changed files
with
270 additions
and
211 deletions.
There are no files selected for viewing
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
23 changes: 0 additions & 23 deletions
23
x-pack/legacy/plugins/code/public/components/commits/commit_link.tsx
This file was deleted.
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
37 changes: 37 additions & 0 deletions
37
x-pack/legacy/plugins/code/public/components/diff_page/accordion.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,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { EuiIcon, EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; | ||
|
||
interface Props { | ||
initialIsOpen: boolean; | ||
title: React.ReactNode; | ||
children: React.ReactNode; | ||
className: string; | ||
} | ||
|
||
export const Accordion = (props: Props) => { | ||
const [isOpen, setOpen] = useState(props.initialIsOpen); | ||
return ( | ||
<EuiPanel paddingSize="none" className={props.className}> | ||
<EuiFlexGroup | ||
gutterSize="none" | ||
justifyContent="spaceBetween" | ||
alignItems="center" | ||
onClick={() => { | ||
setOpen(!isOpen); | ||
}} | ||
> | ||
<EuiFlexItem>{props.title}</EuiFlexItem> | ||
<EuiFlexItem grow={false} className="codeAccordionCollapse__icon"> | ||
<EuiIcon type={isOpen ? 'arrowDown' : 'arrowRight'} /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<div hidden={!isOpen}>{props.children}</div> | ||
</EuiPanel> | ||
); | ||
}; |
48 changes: 40 additions & 8 deletions
48
x-pack/legacy/plugins/code/public/components/diff_page/diff.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 |
---|---|---|
@@ -1,16 +1,48 @@ | ||
.codeDiffCommitSelectorsContainer { | ||
border-left: $euiBorderThin solid $euiColorLightShade; | ||
padding-left: $euiSize; | ||
} | ||
|
||
.codeDiffCommitMessage { | ||
padding: $euiSizeS $euiSize; | ||
} | ||
|
||
.codeDiffChangedFiles { | ||
color: $euiColorPrimary; | ||
} | ||
|
||
.codeDiffMetadata { | ||
padding: 0 $euiSize $euiSizeS $euiSize; | ||
} | ||
|
||
.codeVisualizerIcon { | ||
margin-right: $euiSizeS; | ||
} | ||
|
||
.codeDiffDeletion { | ||
margin: 0 $euiSizeS; | ||
background-color: $euiColorVis0; | ||
} | ||
|
||
.diff > button.euiAccordion__button > div:first-child { | ||
flex-direction: row-reverse; | ||
padding: $euiSize $euiSizeS; | ||
.codeDiff__panel { | ||
padding: 0 $euiSize; | ||
} | ||
|
||
.diff > button.euiAccordion__button { | ||
&:hover { | ||
text-decoration: none; | ||
} | ||
.codeDiff__header { | ||
border-bottom: $euiBorderThin solid $euiColorLightShade; | ||
height: $euiSizeXXL; | ||
padding: $euiSize; | ||
} | ||
|
||
.euiAccordion__iconWrapper { | ||
.codeAccordionCollapse__icon { | ||
margin: auto $euiSize auto 0; | ||
cursor: pointer; | ||
} | ||
|
||
.codeViewFile__button { | ||
height: $euiSizeL !important; | ||
} | ||
|
||
.codeAccordion { | ||
margin-bottom: $euiSizeM; | ||
} |
Oops, something went wrong.