Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .storybook/Container.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2024 The Tekton Authors
Copyright 2019-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -28,3 +28,9 @@ limitations under the License.
background-color: inherit !important;
}
}

[role="main"] > .tkn--task-logs {
.cds--accordion__heading {
inset-block-start: 0; // demonstrate the sticky header behaviour when displayed in isolation
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2024 The Tekton Authors
Copyright 2025-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -11,7 +11,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.tkn--task-tree {
inline-size: 21%;
min-inline-size: 15rem;
import { AccordionItem as CarbonAccordionItem } from '@carbon/react';

function AccordionItem({ children, open, ...rest }) {
return (
<CarbonAccordionItem open={open} {...rest}>
{open ? children : null}
</CarbonAccordionItem>
);
}

export default AccordionItem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright 2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { Accordion } from '@carbon/react';

import AccordionItem from './AccordionItem';

export default {
component: AccordionItem,
title: 'AccordionItem'
};

export const Closed = {
args: {
open: false,
title: 'Closed Accordion Item',
children: <div>This content is not rendered when closed</div>
},
decorators: [
Story => (
<Accordion>
<Story />
</Accordion>
)
]
};

export const Open = {
args: {
open: true,
title: 'Open Accordion Item',
children: (
<div>
<p>This content is rendered when open</p>
<p>
The AccordionItem optimizes rendering by only rendering children when
open
</p>
</div>
)
},
decorators: [
Story => (
<Accordion>
<Story />
</Accordion>
)
]
};

export const MultipleItems = {
render: () => (
<Accordion>
<AccordionItem open title="First Item">
<p>Content of first item</p>
</AccordionItem>
<AccordionItem open={false} title="Second Item">
<p>Content of second item (not rendered)</p>
</AccordionItem>
<AccordionItem open title="Third Item">
<p>Content of third item</p>
</AccordionItem>
</Accordion>
)
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Copyright 2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { render } from '../../utils/test';

import AccordionItem from './AccordionItem';

describe('AccordionItem', () => {
it('should render children when open is true', () => {
const { queryByText } = render(
<AccordionItem open title="Test Title">
<div>Test Content</div>
</AccordionItem>
);
expect(queryByText('Test Content')).toBeTruthy();
});

it('should not render children when open is false', () => {
const { queryByText } = render(
<AccordionItem open={false} title="Test Title">
<div>Test Content</div>
</AccordionItem>
);
expect(queryByText('Test Content')).toBeFalsy();
});

it('should pass through other props to CarbonAccordionItem', () => {
const { container } = render(
<AccordionItem
open
title="Test Title"
className="custom-class"
data-testid="test-accordion"
>
<div>Test Content</div>
</AccordionItem>
);
const accordionItem = container.querySelector('.custom-class');
expect(accordionItem).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2021 The Tekton Authors
Copyright 2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -12,4 +12,4 @@ limitations under the License.
*/
/* istanbul ignore file */

export { default } from './TaskTree';
export { default } from './AccordionItem';
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ header.tkn--step-details-header {
.#{$prefix}--btn-set {
margin-inline: 0.5rem;
align-self: center;
align-items: baseline;

.cds--btn--icon-only {
inline-size: 2rem;
block-size: 2rem;
}
}

.tkn--run-details-name {
Expand Down
34 changes: 2 additions & 32 deletions packages/components/src/components/Log/_Log.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2025 The Tekton Authors
Copyright 2019-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -72,37 +72,7 @@ pre.tkn--log {
.#{$prefix}--btn-set {
position: absolute;
inset-block-start: 0;
inset-inline-end: var(--tkn-log-inline-padding);
align-items: center;
}

.button-container {
position: absolute;
clip-path: inset(0); // ensure the children with position:fixed are not shown outside this element.
inset-block-start: 3.125rem; //equals the maximum between padding-block-start of pre.tkn--log and between the page header height
inset-block-end: 0;
inset-inline-end: 0;
inline-size: var(--tkn-log-inline-padding);
}

.#{$prefix}--btn--ghost,
.#{$prefix}--copy-btn {
inline-size: 2rem;
block-size: 2rem;
min-block-size: 2rem;
background-color: $background;

&:hover {
background-color: $layer-hover;
}

&:focus {
outline-color: white;
}

svg {
fill: $icon-primary;
}
inset-inline-end: 0.5rem; // var(--tkn-log-inline-padding);
}

.tkn--log-trailer {
Expand Down
Loading