Skip to content

Commit cb8feff

Browse files
authored
Add support for externalised attachments (#353)
1 parent 2c826b0 commit cb8feff

25 files changed

+485
-200
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
9+
### Added
10+
- Support for externalised attachments ([#353](https://github.com/cucumber/react-components/pull/353))
911

1012
## [22.1.0] - 2024-03-15
1113
### Added

package-lock.json

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"highlight-words": "1.2.2",
4343
"mime": "^3.0.0",
4444
"react-accessible-accordion": "5.0.0",
45+
"react-error-boundary": "^4.0.13",
4546
"react-markdown": "6.0.3",
4647
"rehype-raw": "5.1.0",
4748
"rehype-sanitize": "4.0.0",

src/components/CucumberReact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface IProps {
1111

1212
export const CucumberReact: FunctionComponent<PropsWithChildren<IProps>> = ({
1313
children,
14-
theme = 'light',
14+
theme = 'auto',
1515
customRendering = {},
1616
className,
1717
}) => {

src/components/customise/customRendering.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface AttachmentProps {
3131
attachment: messages.Attachment
3232
}
3333

34-
export type AttachmentClasses = Styles<'text' | 'icon' | 'image'>
34+
export type AttachmentClasses = Styles<'text' | 'log' | 'icon' | 'image'>
3535

3636
export interface BackgroundProps {
3737
background: messages.Background

src/components/gherkin/Attachment.tsx

Lines changed: 0 additions & 184 deletions
This file was deleted.

src/components/gherkin/GherkinStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import GherkinQueryContext from '../../GherkinQueryContext.js'
1414
import { HighLight } from '../app/HighLight.js'
1515
import { DefaultComponent, GherkinStepProps, useCustomRendering } from '../customise/index.js'
1616
import { TestStepResultDetails } from '../results/index.js'
17-
import { Attachment } from './Attachment.js'
17+
import { Attachment } from './attachment/index.js'
1818
import { DataTable as DataTableComponent } from './DataTable.js'
1919
import { DocString as DocStringComponent } from './DocString.js'
2020
import { Keyword } from './Keyword.js'

src/components/gherkin/HookStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React from 'react'
55
import CucumberQueryContext from '../../CucumberQueryContext.js'
66
import { HookStepProps, useCustomRendering } from '../customise/index.js'
77
import { TestStepResultDetails } from '../results/index.js'
8-
import { Attachment } from './Attachment.js'
8+
import { Attachment } from './attachment/index.js'
99
import { StepItem } from './StepItem.js'
1010
import { Title } from './Title.js'
1111

src/components/gherkin/Attachment.module.scss renamed to src/components/gherkin/attachment/Attachment.module.scss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
@import '../../styles/theming';
1+
@import '../../../styles/theming';
22

33
.text {
4+
position: relative;
45
white-space: pre-wrap;
56
font-family: $monoFamily;
67
font-size: 0.875em;
@@ -12,6 +13,21 @@
1213
color: $codeTextColor;
1314
}
1415

16+
.log {
17+
padding-left: 3.25em;
18+
19+
&::before {
20+
content: 'Log';
21+
position: absolute;
22+
top: 0.666em;
23+
left: 0.75em;
24+
text-transform: uppercase;
25+
font-weight: bold;
26+
color: $parameterColor;
27+
opacity: 0.75;
28+
}
29+
}
30+
1531
.icon {
1632
margin-right: 0.75em;
1733
opacity: 0.333;

0 commit comments

Comments
 (0)