add classNames to various places to allow for more control of styling

This commit is contained in:
Eduardo Perez 2018-10-10 10:58:16 -04:00
parent 8f7fccc657
commit 1f9dc8d9f7
14 changed files with 25 additions and 14 deletions

View File

@ -74,7 +74,9 @@ export const PropertyNameCell = withProps<{ kind?: string }>(styled(PropertyCell
${extensionsHook('PropertyNameCell')}; ${extensionsHook('PropertyNameCell')};
`; `;
export const PropertyDetailsCell = styled.td` export const PropertyDetailsCell = styled.td.attrs({
className: 'property-details-cell',
})`
border-bottom: 1px solid #9fb4be; border-bottom: 1px solid #9fb4be;
padding: 10px 0; padding: 10px 0;
width: ${props => props.theme.schema.defaultDetailsWidth}; width: ${props => props.theme.schema.defaultDetailsWidth};

View File

@ -36,7 +36,9 @@ export const TypeTitle = styled(FieldLabel)`
export const TypeFormat = TypeName; export const TypeFormat = TypeName;
export const RequiredLabel = styled(FieldLabel.withComponent('div'))` export const RequiredLabel = styled(FieldLabel.withComponent('div')).attrs({
className: 'required-label',
})`
color: ${props => props.theme.schema.requireLabelColor}; color: ${props => props.theme.schema.requireLabelColor};
font-size: ${props => props.theme.schema.labelsTextSize}; font-size: ${props => props.theme.schema.labelsTextSize};
font-weight: normal; font-weight: normal;

View File

@ -33,7 +33,9 @@ export const H3 = styled.h2`
${extensionsHook('H3')}; ${extensionsHook('H3')};
`; `;
export const RightPanelHeader = styled.h3` export const RightPanelHeader = styled.h3.attrs({
className: 'right-panel-header',
})`
color: ${({ theme }) => theme.rightPanel.textColor}; color: ${({ theme }) => theme.rightPanel.textColor};
${extensionsHook('RightPanelHeader')}; ${extensionsHook('RightPanelHeader')};

View File

@ -15,6 +15,7 @@ export const MiddlePanel = styled.div`
export const Section = withProps<{ underlined?: boolean }>( export const Section = withProps<{ underlined?: boolean }>(
styled.div.attrs({ styled.div.attrs({
[SECTION_ATTR]: props => props.id, [SECTION_ATTR]: props => props.id,
className: 'section',
} as any), } as any),
)` )`
padding: ${props => props.theme.spacing.sectionVertical}px 0; padding: ${props => props.theme.spacing.sectionVertical}px 0;

View File

@ -1,3 +1,4 @@
import * as classnames from 'classnames';
import * as React from 'react'; import * as React from 'react';
import styled, { withProps } from '../styled-components'; import styled, { withProps } from '../styled-components';
@ -19,7 +20,7 @@ class IntShelfIcon extends React.PureComponent<{
render() { render() {
return ( return (
<svg <svg
className={this.props.className} className={classnames(this.props.className, 'shelf-icon')}
style={this.props.style} style={this.props.style}
version="1.1" version="1.1"
viewBox="0 0 24 24" viewBox="0 0 24 24"

View File

@ -71,7 +71,7 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
null; null;
return ( return (
<Section> <Section className="api-info-section">
<Row> <Row>
<MiddlePanel className="api-info"> <MiddlePanel className="api-info">
<ApiHeader> <ApiHeader>

View File

@ -22,8 +22,9 @@ export class ApiLogo extends React.Component<{ info: OpenAPIInfo }> {
alt={altText} alt={altText}
/> />
); );
return ( return (
<LogoWrap> <LogoWrap className="api-logo">
{info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo}{' '} {info.contact && info.contact.url ? LinkWrap(info.contact.url)(logo) : logo}{' '}
</LogoWrap> </LogoWrap>
); );

View File

@ -18,11 +18,11 @@ export function SanitizedMarkdownHTML(
<OptionsConsumer> <OptionsConsumer>
{options => ( {options => (
<Wrap <Wrap
{...props}
className={'redoc-markdown ' + (props.className || '')} className={'redoc-markdown ' + (props.className || '')}
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: sanitize(options.untrustedSpec, props.html), __html: sanitize(options.untrustedSpec, props.html),
}} }}
{...props}
/> />
)} )}
</OptionsConsumer> </OptionsConsumer>

View File

@ -48,7 +48,7 @@ export class Operation extends React.Component<OperationProps> {
{options => ( {options => (
<OperationRow> <OperationRow>
<MiddlePanel> <MiddlePanel>
<H2> <H2 className="operation-heading">
<ShareLink to={operation.id} /> <ShareLink to={operation.id} />
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>} {summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
</H2> </H2>

View File

@ -26,7 +26,7 @@ export class RequestSamples extends React.Component<RequestSamplesProps> {
<div> <div>
<RightPanelHeader> Request samples </RightPanelHeader> <RightPanelHeader> Request samples </RightPanelHeader>
<Tabs defaultIndex={0}> <Tabs className="right-panel-tabs" defaultIndex={0}>
<TabList> <TabList>
{hasBodySample && <Tab key="payload"> Payload </Tab>} {hasBodySample && <Tab key="payload"> Payload </Tab>}
{samples.map(sample => ( {samples.map(sample => (

View File

@ -25,7 +25,7 @@ export class ResponseSamples extends React.Component<ResponseSamplesProps> {
<div> <div>
<RightPanelHeader> Response samples </RightPanelHeader> <RightPanelHeader> Response samples </RightPanelHeader>
<Tabs defaultIndex={0}> <Tabs className="right-panel-tabs" defaultIndex={0}>
<TabList> <TabList>
{responses.map(response => ( {responses.map(response => (
<Tab className={'tab-' + response.type} key={response.code}> <Tab className={'tab-' + response.type} key={response.code}>

View File

@ -88,7 +88,9 @@ const AuthHeaderColumn = styled.div`
flex: 1; flex: 1;
`; `;
const SecuritiesColumn = styled.div` const SecuritiesColumn = styled.div.attrs({
className: 'securities-column',
})`
width: ${props => props.theme.schema.defaultDetailsWidth}; width: ${props => props.theme.schema.defaultDetailsWidth};
`; `;
@ -114,7 +116,7 @@ export class SecurityRequirements extends React.PureComponent<SecurityRequiremen
return null; return null;
} }
return ( return (
<Wrap> <Wrap className="security-requirements">
<AuthHeaderColumn> <AuthHeaderColumn>
<AuthHeader>Authorizations: </AuthHeader> <AuthHeader>Authorizations: </AuthHeader>
</AuthHeaderColumn> </AuthHeaderColumn>

View File

@ -70,7 +70,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
<Section id={scheme.sectionId} key={scheme.id}> <Section id={scheme.sectionId} key={scheme.id}>
<Row> <Row>
<MiddlePanel> <MiddlePanel>
<H2> <H2 className="security-defs-heading">
<ShareLink to={scheme.sectionId} /> <ShareLink to={scheme.sectionId} />
{scheme.id} {scheme.id}
</H2> </H2>

View File

@ -21,7 +21,7 @@ export class SideMenu extends React.Component<{ menu: MenuStore; className?: str
wheelPropagation: false, wheelPropagation: false,
}} }}
> >
<MenuItems items={store.items} onActivate={this.activate} root={true} /> <MenuItems className="side-menu-items" items={store.items} onActivate={this.activate} root={true} />
<RedocAttribution> <RedocAttribution>
<a target="_blank" href="https://github.com/Rebilly/ReDoc"> <a target="_blank" href="https://github.com/Rebilly/ReDoc">
Documentation Powered by ReDoc Documentation Powered by ReDoc