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

View File

@ -60,11 +60,11 @@ export type Props = {
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;
return (
<Wrapper>
<Wrapper className={className}>
<label>
{label && <LabelText>{label}</LabelText>}
<Outline>

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@ import Flex from 'shared/components/Flex';
import Button from 'components/Button';
import Input from 'components/Input';
import HelpText from 'components/HelpText';
import { Label } from 'components/Labeled';
import SlackAuthLink from 'components/SlackAuthLink';
@observer class Settings extends React.Component {
@ -28,10 +29,10 @@ import SlackAuthLink from 'components/SlackAuthLink';
<Flex column>
{showSlackSettings &&
<Section>
<h2>Slack</h2>
<SectionLabel>Slack</SectionLabel>
<HelpText>
Connect Atlas to your Slack to instantly search for your documents
using <code>/atlas</code> command.
using <Code>/atlas</Code> command.
</HelpText>
<SlackAuthLink
@ -49,7 +50,7 @@ import SlackAuthLink from 'components/SlackAuthLink';
</Section>}
<Section>
<h2>API access</h2>
<SectionLabel>API Access</SectionLabel>
<HelpText>
Create API tokens to hack on your Atlas.
Learn more in <Link to="/developers">API documentation</Link>.
@ -130,14 +131,14 @@ class InlineForm extends React.Component {
return (
<form onSubmit={this.handleSubmit}>
<Flex auto>
<Input
<ApiKeyInput
type="text"
placeholder={validationError ? 'Please add a label' : placeholder}
value={value || ''}
onChange={onChange}
validationError={validationError}
/>
<Button type="submit" value={buttonLabel} />
<Button type="submit" value={buttonLabel} size="small" />
</Flex>
</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;