Skip to content

Commit f84777b

Browse files
committed
Move icon rotation class to container so it acts on custom icons too
1 parent fc3bbe3 commit f84777b

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

demo/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ function App() {
366366
stringTruncate={90}
367367
customNodeDefinitions={dataDefinition?.customNodeDefinitions}
368368
customText={dataDefinition?.customTextDefinitions}
369+
// icons={{ chevron: <IconCancel size="1.2em" /> }}
369370
// customButtons={[
370371
// {
371372
// Element: () => (

src/CollectionNode.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,10 @@ export const CollectionNode: React.FC<CollectionNodeProps> = (props) => {
384384
{showCollectionWrapper ? (
385385
<div className="jer-collection-header-row" style={{ position: 'relative' }}>
386386
<div className="jer-collection-name">
387-
<div className="jer-collapse-icon" onClick={(e) => handleCollapse(e)}>
387+
<div
388+
className={`jer-collapse-icon jer-accordion-icon${collapsed ? ' jer-rotate-90' : ''}`}
389+
onClick={(e) => handleCollapse(e)}
390+
>
388391
<Icon name="chevron" rotate={collapsed} nodeData={nodeData} />
389392
</div>
390393
{KeyDisplay}

src/Icons.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,7 @@ export const Icon: React.FC<IconSharedProps> = ({ name, nodeData, rotate }): JSX
170170
)
171171
case 'chevron':
172172
return (
173-
icons?.chevron ?? (
174-
<IconChevron
175-
className={`jer-accordion-icon${rotate ? ' jer-rotate-90' : ''}`}
176-
size="1em"
177-
style={getStyles('iconCollection', nodeData)}
178-
/>
179-
)
173+
icons?.chevron ?? <IconChevron size="1em" style={getStyles('iconCollection', nodeData)} />
180174
)
181175
default:
182176
return <></>

0 commit comments

Comments
 (0)