Skip to content

Commit

Permalink
feat(Error, Header): created Error, Buttons, and Header components to…
Browse files Browse the repository at this point in the history
… be used in the Modal
  • Loading branch information
ramfox committed Jul 26, 2019
1 parent 7513b57 commit e4c6405
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 3 deletions.
19 changes: 19 additions & 0 deletions app/components/modals/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from 'react'
import Button from '../chrome/Button'

interface ButtonsProps {
cancelText: string
submitText: string
disabled: boolean
loading: boolean
onCancel: () => void
onSubmit: () => void
}

const Buttons: React.FunctionComponent<ButtonsProps> = ({ cancelText, submitText, disabled, loading, onCancel, onSubmit }) =>
<div className='buttons'>
{cancelText && onCancel ? <Button text={cancelText} onClick={onCancel} color='muted' /> : <div></div>}
<Button color='primary' text={submitText} onClick={onSubmit} loading={loading} disabled={disabled} />
</div>

export default Buttons
9 changes: 9 additions & 0 deletions app/components/modals/Error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react'

interface ErrorProps {
text: string
}
const Error: React.FunctionComponent<ErrorProps> = ({ text }) =>
<div className='error'>{text}</div>

export default Error
2 changes: 1 addition & 1 deletion app/components/modals/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DialogHeader: React.FunctionComponent<IDialogHeaderProps> = ({ onDismissed
className="close"
onClick={onCloseButtonClick}
aria-label="close"
role="button" >x</a>
role="button" ><span className='icon'>close</span></a>
)
}

Expand Down
72 changes: 70 additions & 2 deletions app/scss/_dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,76 @@ dialog {
max-width: 600px;

&::backgrop {
background-color: rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.7);
opacity: 1;
z-index: $zindex-modal;
}
}

.dialog-header {
height: 50px;
border-bottom: solid 1px $border-color;

display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: $spacer;

h1 {
font-weight: $font-weight-bold;
font-size: $font-size-lg;
margin: 0;
padding: 0;
margin-right: $spacer;
}

.close {
flex-shrink: 0;

border: 0;
height: 16px;
width: 16px;

// Set the left margin to auto so that flexbox positions the button
// on the right hand side of the dialog and add a -10px right hand
// side margin to put the button where it should be (we use a double
// margin for the header itself).
margin: $spacer * -3 $spacer * -1 0 auto;
padding: 0;
background: transparent;

color: $primary-muted;
cursor: pointer;

// Let the button deal with all mouse events.
// Without this the octicon resets the cursor when
// hovering over the <path>.
.octicon {
pointer-events: none;
}

&:hover {
color: $text;
}

&:focus {
outline: 0;
}
}
}

form {
padding: $spacer
}

.error {
color: $error;
margin: 0 1rem 1rem 0;
}

.buttons {
display: flex;
justify-content: space-between;
align-items: center;
}
}

0 comments on commit e4c6405

Please sign in to comment.