Skip to content

Commit

Permalink
feat: added animations and base styling is reverted to previous
Browse files Browse the repository at this point in the history
  • Loading branch information
flops committed Jan 30, 2024
1 parent ba5eec1 commit 783432b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/components/GridItem/GridItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GridItem extends React.PureComponent {
static contextType = DashKitContext;

overlayRef = React.createRef(null);
controlsRef = React.createRef();
controlsRef = React.createRef(null);

renderOverlay() {
const {overlayControls} = this.props;
Expand Down Expand Up @@ -68,10 +68,11 @@ class GridItem extends React.PureComponent {
unmountOnExit
>
<OverlayControls
ref={this.controlsRef}
configItem={item}
items={controls}
overlayControls={overlayControls}
forwardRef={this.controlsRef}
className={b('controls')}
/>
</CSSTransition>
</>
Expand Down
9 changes: 5 additions & 4 deletions src/components/GridItem/GridItem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
left: 0;
right: 0;
border-radius: 3px;
background-color: var(--g-color-base-float);
background-color: var(--g-color-base-generic);
border: solid 1px rgba(0, 0, 0, 0.1);
opacity: 0.5;
// opacity: 0.5;

&-enter {
opacity: 0;
will-change: opacity;

&-active {
opacity: 0.5;
opacity: 1;
transition: opacity 300ms ease-in-out;
}
}

&-exit {
opacity: 0.5;
opacity: 1;
will-change: opacity;

&-active {
Expand Down Expand Up @@ -64,6 +64,7 @@
border-radius: 3px;

&_editMode {
opacity: 0.5;
border-color: transparent;
pointer-events: none;
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/OverlayControls/OverlayControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ interface OverlayControlsProps extends OverlayControlsDefaultProps {
items?: OverlayControlItem[];
overlayControls?: Record<string, OverlayControlItem[]>;
forwardRef?: React.ForwardedRef<HTMLDivElement>;
className?: string;
}

type PreparedCopyItemOptionsArg = Pick<ConfigItem, 'data' | 'type' | 'defaults' | 'namespace'> & {
Expand Down Expand Up @@ -97,17 +98,17 @@ class OverlayControls extends React.Component<OverlayControlsProps> {
size: 'm',
};
context!: React.ContextType<DashKitCtx>;
ref = null;

render() {
const {items = [], position} = this.props;
const {items = [], position, className} = this.props;
const hasCustomControlsWithWidgets = items.length > 0;

const controls = hasCustomControlsWithWidgets
? this.getCustomControlsWithWidgets()
: this.renderControls();

return (
<div ref={this.ref || this.props.forwardRef} className={b({position})}>
<div ref={this.props.forwardRef} className={b({position}, className)}>
{controls}
</div>
);
Expand Down

0 comments on commit 783432b

Please sign in to comment.