Skip to content

Commit

Permalink
Merge pull request #212 from chenz24/diff-viewer
Browse files Browse the repository at this point in the history
Rename DiffView to DiffViewer.
  • Loading branch information
chenz24 authored Nov 29, 2022
2 parents d1d8a53 + e1cff67 commit acbeb9a
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-sloths-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kubed/diff-viewer': patch
---

rename DiffView to DiffViewer.
1 change: 1 addition & 0 deletions packages/components/src/Modal/Modal.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const Basic = () => {
description="Modal description"
titleIcon={<Cluster size={40} />}
onCancel={closeModal}
footer={<div>footer</div>}
>
Modal content
</Modal>
Expand Down
21 changes: 16 additions & 5 deletions packages/components/src/Tag/Tag.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ export const Append = () => (
</Tag>
);

export const Closable = () => (
<Tag radius="lg" closable className="filter-tag">
Add
</Tag>
);
export const Closable = () => {
const tags = ['apple', 'banana'];

return tags.map((tag) => (
<Tag
radius="lg"
closable
className="filter-tag"
onClose={() => {
console.log(tag);
}}
>
{tag}
</Tag>
));
};
1 change: 0 additions & 1 deletion packages/diff-view/src/index.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kubed/diff-view",
"name": "@kubed/diff-viewer",
"version": "0.0.1",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand All @@ -15,7 +15,7 @@
"repository": {
"url": "https://github.com/kubesphere/kube-design.git",
"type": "git",
"directory": "packages/diff-view"
"directory": "packages/diff-viewer"
},
"peerDependencies": {
"@kubed/hooks": "0.0.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import { useState } from 'react';
import { Button } from '@kubed/components';
import { DiffView } from './DiffView';
import { DiffViewer } from './DiffViewer';

export default {
title: 'Extension-Components/DiffView',
component: DiffView,
title: 'Extension-Components/DiffViewer',
component: DiffViewer,
};

export const basic = () => {
Expand Down Expand Up @@ -102,7 +102,7 @@ spec:
return (
<>
<Button onClick={handleChange}>Change Value</Button>
<DiffView
<DiffViewer
title="配置文件"
description="与上一个记录 #7 (85f76fb8d7) 对比"
oldValue={oldValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ const getDiffHtml = (oldValue, newValue, options = {}) => {
});
};

export interface DiffViewProps {
export interface DiffViewerProps {
title?: string | React.ReactNode;
description?: string | React.ReactNode;
mode?: 'line-by-line' | 'side-by-side';
oldValue: string;
newValue: string;
}

export const DiffView = ({
export const DiffViewer = ({
title,
description,
mode = 'line-by-line',
oldValue,
newValue,
}: DiffViewProps) => {
}: DiffViewerProps) => {
const [_mode, setMode] = useState(mode);
const [diffHtml, setDiffHtml] = useState(getDiffHtml(oldValue, newValue, { outputFormat: mode }));

Expand Down
1 change: 1 addition & 0 deletions packages/diff-viewer/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './DiffViewer';
File renamed without changes.
File renamed without changes.

1 comment on commit acbeb9a

@vercel
Copy link

@vercel vercel bot commented on acbeb9a Nov 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kube-design – ./

kube-design-git-master-chenz8606.vercel.app
kube-design-chenz8606.vercel.app
kube-design.vercel.app

Please sign in to comment.