Skip to content

Commit

Permalink
update components
Browse files Browse the repository at this point in the history
  • Loading branch information
acharyakavita committed Dec 2, 2023
1 parent f3524db commit e35f9be
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
9 changes: 6 additions & 3 deletions docs/src/partials/gallery/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import ReactDOMServer from "react-dom/server";
import { transform } from "babel-standalone";

const PreviewWrapper = styled.div``;

const defaultProps = {
previewComponent: "div",
}
// <Preview> component from component-playground without updating
const Preview = (props) => {
const Preview = (_props) => {
const props = {...defaultProps,_props}
let ref = useRef();

const compileCode = () => {
Expand Down Expand Up @@ -51,7 +54,7 @@ const Preview = (props) => {

const executeCode = () => {
const mountNode = ref;
const { scope, noRender, previewComponent="div" } = props;
const { scope, noRender, previewComponent } = props;
const tempScope = [];

Object.keys(scope).forEach((s) => tempScope.push(scope[s]));
Expand Down
7 changes: 6 additions & 1 deletion docs/src/partials/sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ const getMatchTree = (link, filterTerm) => {
}
return [];
};
const defaultProps = {
className:""
}

const Sidebar = ({ className="", content, onCloseClick }) => {
const Sidebar = (_props) => {
const props = {...defaultProps,_props}
const { className, content, onCloseClick } = props
const location = useLocation();
const [filteredResults, setFilteredResults] = useState(content);
const [filterTerm, setFilterTerm] = useState("");
Expand Down
23 changes: 15 additions & 8 deletions packages/victory-area/src/area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,29 @@ const evaluateProps = (props: AreaProps) => {
return assign({}, props, { ariaLabel, desc, id, style, tabIndex });
};

const defaultProps={
groupComponent: <g />,
pathComponent: <Path />,
role: "presentation",
shapeRendering: "auto",
}

/**
* The area primitive used by VictoryArea
*/
export const Area: React.FC<AreaProps> = (props) => {
props = evaluateProps(props);
props = evaluateProps({...defaultProps,...props});
const {
ariaLabel,
role = "presentation",
shapeRendering = "auto",
role,
shapeRendering,
className,
polar,
origin,
data,
pathComponent = <Path />,
pathComponent,
events,
groupComponent = <g />,
groupComponent,
clipPath,
id,
style,
Expand Down Expand Up @@ -137,7 +144,7 @@ export const Area: React.FC<AreaProps> = (props) => {
};

const area = React.cloneElement(
pathComponent,
pathComponent!,
assign(
{
key: `${id}-area`,
Expand All @@ -153,7 +160,7 @@ export const Area: React.FC<AreaProps> = (props) => {

const line = renderLine
? React.cloneElement(
pathComponent,
pathComponent!,
assign(
{
key: `${id}-area-stroke`,
Expand All @@ -166,7 +173,7 @@ export const Area: React.FC<AreaProps> = (props) => {
: null;

return renderLine
? React.cloneElement(groupComponent, userProps, [area, line])
? React.cloneElement(groupComponent!, userProps, [area, line])
: area;
};

Expand Down

0 comments on commit e35f9be

Please sign in to comment.