Skip to content

Commit

Permalink
responsive cta button
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <huongg1409@gmail>
  • Loading branch information
Huong Nguyen committed Jul 16, 2024
1 parent 0ff7dc1 commit deca337
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import React, { Component } from 'react';
import React from 'react';
import classnames from 'classnames';

Check warning on line 2 in src/components/flowchart/components/slice-pipeline-action/slice-pipeline-action.js

View workflow job for this annotation

GitHub Actions / javascript_lint_and_tests

'classnames' is defined but never used

Check warning on line 2 in src/components/flowchart/components/slice-pipeline-action/slice-pipeline-action.js

View workflow job for this annotation

GitHub Actions / javascript_lint_and_tests

'classnames' is defined but never used
import Button from '../../../ui/button';

import './slice-pipeline-action.scss';

export const SlicePipelineAction = ({ filteredPipeline }) => {
export const SlicePipelineAction = ({ chartSize, filteredPipeline }) => {
const { outerWidth, sidebarWidth } = chartSize;
const sidebarVisible = sidebarWidth > 140;

const transformX = sidebarVisible ? outerWidth / 2 + 100 : outerWidth / 2;
if (filteredPipeline.length > 0) {
return (
<div className="pipeline-flowchart_slice-action">
<div
className="pipeline-flowchart_slice-action"
style={{ transform: `translateX(${transformX}px)` }}
>
<div className="pipeline-flowchart_slice-action--info">
{`${filteredPipeline.length} selected`}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../../../../styles/variables' as colors;
@use '../../../../styles/variables' as styles;
@use '../../styles/variables';

$padding-top-bottom: 8px;
Expand All @@ -9,10 +9,10 @@ $padding-right-left: 16px;
border-radius: 4px;
bottom: 30px;
display: flex;
left: 60%;
margin: 0;
padding: 0;
position: absolute;
transition: transform ease 0.7s;
}

.pipeline-flowchart_slice-action--info {
Expand Down
6 changes: 5 additions & 1 deletion src/components/flowchart/flowchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,11 @@ export class FlowChart extends Component {
})}
ref={this.layerNamesRef}
/>
<SlicePipelineAction filteredPipeline={filteredPipelineState.range} />
<SlicePipelineAction
chartSize={chartSize}
filteredPipeline={filteredPipelineState.range}
ref={this.layerNamesRef}
/>
<Tooltip
chartSize={chartSize}
{...this.state.tooltip}
Expand Down

0 comments on commit deca337

Please sign in to comment.