Skip to content

Commit 705eb95

Browse files
authored
feat: show container size (#21)
* feat: show container size * fix: units * fix: add test * feat: add initially collapsed and tests * fix: review
1 parent 6fe3b68 commit 705eb95

19 files changed

+291
-104
lines changed

src/ReactUnipika/ReactUnipika.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export interface ReactUnipikaProps {
2222
toolbarStickyTop?: number;
2323
renderToolbar?: (props: ToolbarProps) => React.ReactNode;
2424
collapseIconType?: CollapseIconType;
25+
showContainerSize?: boolean;
26+
initiallyCollapsed?: boolean;
2527
}
2628

2729
const defaultUnipikaSettings = {
@@ -45,6 +47,8 @@ export function ReactUnipika({
4547
toolbarStickyTop = 0,
4648
renderToolbar,
4749
collapseIconType,
50+
showContainerSize,
51+
initiallyCollapsed,
4852
}: ReactUnipikaProps) {
4953
const convertedValue = React.useMemo(() => {
5054
// TODO: fix me later
@@ -98,6 +102,8 @@ export function ReactUnipika({
98102
toolbarStickyTop={toolbarStickyTop}
99103
renderToolbar={renderToolbar}
100104
collapseIconType={collapseIconType}
105+
showContainerSize={showContainerSize}
106+
initiallyCollapsed={initiallyCollapsed}
101107
/>
102108
) : (
103109
<pre
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

src/ReactUnipika/__stories__/ReactUnipika.stories.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,26 @@ export const WithContentAbove: StoryObj<ReactUnipikaProps> = {
3737
);
3838
},
3939
};
40+
41+
export const WithContainerSize: StoryObj<ReactUnipikaProps> = {
42+
args: {
43+
value: data,
44+
showContainerSize: true,
45+
},
46+
};
47+
48+
export const WithContainerSizeCollapsed: StoryObj<ReactUnipikaProps> = {
49+
args: {
50+
value: data,
51+
showContainerSize: true,
52+
initiallyCollapsed: true,
53+
},
54+
};
55+
56+
export const WithContainerSizeYson: StoryObj<ReactUnipikaProps> = {
57+
args: {
58+
value: data,
59+
settings: {format: 'yson'},
60+
showContainerSize: true,
61+
},
62+
};

0 commit comments

Comments
 (0)