CSS fixes

This commit is contained in:
Jori Lallo
2017-11-07 22:02:07 -08:00
parent 53cda8ce2b
commit 01af3e8c36
7 changed files with 40 additions and 34 deletions

View File

@ -7,17 +7,17 @@ import { darken, lighten } from 'polished';
const RealButton = styled.button` const RealButton = styled.button`
display: inline-block; display: inline-block;
margin: 0; margin: 0;
padding: 0; padding: 4px 12px;
border: 0; border: 0;
background: ${color.primary}; background: ${color.primary};
color: ${color.white}; color: ${color.white};
border-radius: 4px; border-radius: 4px;
font-size: 15px; font-size: 15px;
min-width: 32px; height: 36px;
min-height: 32px;
text-decoration: none; text-decoration: none;
flex-shrink: 0; flex-shrink: 0;
outline: none; outline: none;
cursor: pointer;
&::-moz-focus-inner { &::-moz-focus-inner {
padding: 0; padding: 0;
@ -70,24 +70,9 @@ const Label = styled.span`
${props => props.hasIcon && 'padding-left: 2px;'} ${props => props.hasIcon && 'padding-left: 2px;'}
`; `;
const Inner = styled.span`
padding: 4px 16px;
display: flex;
line-height: 28px;
justify-content: center;
align-items: center;
${props => props.small && `
padding: 1px 10px;
`}
${props => props.hasIcon && (props.small ? 'padding-left: 6px;' : 'padding-left: 10px;')}
`;
export type Props = { export type Props = {
type?: string, type?: string,
value?: string, value?: string,
small?: boolean,
icon?: React$Element<any>, icon?: React$Element<any>,
className?: string, className?: string,
children?: React$Element<any>, children?: React$Element<any>,
@ -97,7 +82,6 @@ export default function Button({
type = 'text', type = 'text',
icon, icon,
children, children,
small,
value, value,
...rest ...rest
}: Props) { }: Props) {
@ -106,10 +90,8 @@ export default function Button({
return ( return (
<RealButton {...rest}> <RealButton {...rest}>
<Inner hasIcon={hasIcon} small={small}> {hasIcon && icon}
{hasIcon && icon} {hasText && <Label hasIcon={hasIcon}>{children || value}</Label>}
{hasText && <Label hasIcon={hasIcon}>{children || value}</Label>}
</Inner>
</RealButton> </RealButton>
); );
} }

View File

@ -60,11 +60,11 @@ export type Props = {
className?: string, className?: string,
}; };
export default function Input({ type, label, ...rest }: Props) { export default function Input({ type, label, className, ...rest }: Props) {
const InputComponent = type === 'textarea' ? RealTextarea : RealInput; const InputComponent = type === 'textarea' ? RealTextarea : RealInput;
return ( return (
<Wrapper> <Wrapper className={className}>
<label> <label>
{label && <LabelText>{label}</LabelText>} {label && <LabelText>{label}</LabelText>}
<Outline> <Outline>

View File

@ -12,12 +12,12 @@ type Props = {
const Labeled = ({ label, children, ...props }: Props) => ( const Labeled = ({ label, children, ...props }: Props) => (
<Flex column {...props}> <Flex column {...props}>
<Header>{label}</Header> <Label>{label}</Label>
{children} {children}
</Flex> </Flex>
); );
const Header = styled(Flex)` export const Label = styled(Flex)`
margin-bottom: ${size.medium}; margin-bottom: ${size.medium};
font-size: 13px; font-size: 13px;
font-weight: 500; font-weight: 500;

View File

@ -1,3 +1,4 @@
// @flow // @flow
import Labeled from './Labeled'; import Labeled, { Label } from './Labeled';
export default Labeled; export default Labeled;
export { Label };

View File

@ -10,7 +10,7 @@ import CollapsedIcon from 'components/Icon/CollapsedIcon';
const activeStyle = { const activeStyle = {
color: color.black, color: color.black,
fontWeight: fontWeight.semiBold, fontWeight: fontWeight.medium,
}; };
const StyledGoTo = styled(CollapsedIcon)` const StyledGoTo = styled(CollapsedIcon)`

View File

@ -16,6 +16,10 @@ type Props = {
}; };
injectGlobal` injectGlobal`
.ReactModal__Overlay {
z-index: 100;
}
.ReactModal__Body--open { .ReactModal__Body--open {
overflow: hidden; overflow: hidden;
} }

View File

@ -11,6 +11,7 @@ import Flex from 'shared/components/Flex';
import Button from 'components/Button'; import Button from 'components/Button';
import Input from 'components/Input'; import Input from 'components/Input';
import HelpText from 'components/HelpText'; import HelpText from 'components/HelpText';
import { Label } from 'components/Labeled';
import SlackAuthLink from 'components/SlackAuthLink'; import SlackAuthLink from 'components/SlackAuthLink';
@observer class Settings extends React.Component { @observer class Settings extends React.Component {
@ -28,10 +29,10 @@ import SlackAuthLink from 'components/SlackAuthLink';
<Flex column> <Flex column>
{showSlackSettings && {showSlackSettings &&
<Section> <Section>
<h2>Slack</h2> <SectionLabel>Slack</SectionLabel>
<HelpText> <HelpText>
Connect Atlas to your Slack to instantly search for your documents Connect Atlas to your Slack to instantly search for your documents
using <code>/atlas</code> command. using <Code>/atlas</Code> command.
</HelpText> </HelpText>
<SlackAuthLink <SlackAuthLink
@ -49,7 +50,7 @@ import SlackAuthLink from 'components/SlackAuthLink';
</Section>} </Section>}
<Section> <Section>
<h2>API access</h2> <SectionLabel>API Access</SectionLabel>
<HelpText> <HelpText>
Create API tokens to hack on your Atlas. Create API tokens to hack on your Atlas.
Learn more in <Link to="/developers">API documentation</Link>. Learn more in <Link to="/developers">API documentation</Link>.
@ -130,14 +131,14 @@ class InlineForm extends React.Component {
return ( return (
<form onSubmit={this.handleSubmit}> <form onSubmit={this.handleSubmit}>
<Flex auto> <Flex auto>
<Input <ApiKeyInput
type="text" type="text"
placeholder={validationError ? 'Please add a label' : placeholder} placeholder={validationError ? 'Please add a label' : placeholder}
value={value || ''} value={value || ''}
onChange={onChange} onChange={onChange}
validationError={validationError} validationError={validationError}
/> />
<Button type="submit" value={buttonLabel} /> <Button type="submit" value={buttonLabel} size="small" />
</Flex> </Flex>
</form> </form>
); );
@ -158,4 +159,22 @@ const Table = styled.table`
} }
`; `;
const SectionLabel = styled(Label)`
padding-bottom: 12px;
margin-bottom: 20px;
border-bottom: 1px solid #EAEBEA;
`;
const Code = styled.code`
padding: 4px 6px;
margin: 0 2px;
background: #EAEBEA;
border-radius: 4px;
`;
const ApiKeyInput = styled(Input)`
width: 100%;
margin-right: 12px;
`;
export default Settings; export default Settings;