From 03586cfcecc5cfd366f1a0b6ac64a2d8bf6483c3 Mon Sep 17 00:00:00 2001 From: Oleksiy Kachynskyy Date: Wed, 8 Apr 2020 09:41:39 +0300 Subject: [PATCH] fix: update StyledCallbackTitle to fix chevron animation --- src/components/Callbacks/CallbackOperation.tsx | 7 +++++-- src/components/Callbacks/CallbackTitle.tsx | 17 ++++++++++++----- src/components/__tests__/Callbacks.test.tsx | 11 +---------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/components/Callbacks/CallbackOperation.tsx b/src/components/Callbacks/CallbackOperation.tsx index 7b9792a6..f811cdb5 100644 --- a/src/components/Callbacks/CallbackOperation.tsx +++ b/src/components/Callbacks/CallbackOperation.tsx @@ -12,13 +12,16 @@ export class CallbackOperation extends React.Component<{ callbackOperation: Oper }; render() { - const { expanded } = this.props.callbackOperation; + const { name, expanded, httpVerb, deprecated } = this.props.callbackOperation; return ( <> {expanded && } diff --git a/src/components/Callbacks/CallbackTitle.tsx b/src/components/Callbacks/CallbackTitle.tsx index 5dcbcbe6..41022c2e 100644 --- a/src/components/Callbacks/CallbackTitle.tsx +++ b/src/components/Callbacks/CallbackTitle.tsx @@ -6,23 +6,24 @@ import { shortenHTTPVerb } from '../../utils/openapi'; import styled from '../../styled-components'; import { Badge } from '../../common-elements/'; import { l } from '../../services/Labels'; -import { OperationModel } from '../../services/models'; export interface CallbackTitleProps { + name: string; + opened?: boolean; + httpVerb: string; + deprecated?: boolean; className?: string; onClick?: () => void; - callbackOperation: OperationModel; } export class CallbackTitle extends React.PureComponent { render() { - const { className, onClick, callbackOperation } = this.props; - const { name, httpVerb, deprecated, expanded } = callbackOperation; + const { name, opened, className, onClick, httpVerb, deprecated } = this.props; return ( {shortenHTTPVerb(httpVerb)} - + {name} {deprecated ? {l('deprecated')} : null} @@ -34,6 +35,12 @@ const CallbackTitleWrapper = styled.div` & > * { vertical-align: middle; } + + ${ShelfIcon} { + polygon { + fill: ${({ theme }) => theme.colors.gray.A200}; + } + } `; const CallbackName = styled.span<{ deprecated?: boolean }>` diff --git a/src/components/__tests__/Callbacks.test.tsx b/src/components/__tests__/Callbacks.test.tsx index b5d3aa5d..8cb2b39a 100644 --- a/src/components/__tests__/Callbacks.test.tsx +++ b/src/components/__tests__/Callbacks.test.tsx @@ -8,7 +8,6 @@ import { CallbackModel } from '../../services/models/Callback'; import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions'; import { CallbacksList, CallbackTitle, CallbackOperation } from '../Callbacks'; import * as simpleCallbackFixture from './fixtures/simple-callback.json'; -import { OperationModel } from '../../services/models'; const options = new RedocNormalizedOptions({}); describe('Components', () => { @@ -32,16 +31,8 @@ describe('Components', () => { }); it('should correctly render CallbackTitle', () => { - const callbackOperation = { - name: 'Test', - httpVerb: 'get', - } as OperationModel; const callbackTitleViewElement = shallow( - , + , ).getElement(); expect(callbackTitleViewElement.props).toBeDefined(); expect(callbackTitleViewElement.props.className).toEqual('.test');