Skip to content

Commit

Permalink
fix: graph carousel buttons are now grid items
Browse files Browse the repository at this point in the history
  • Loading branch information
jcw780 committed Jul 14, 2020
1 parent f252d66 commit 3a89720
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Button, Col, Row} from 'react-bootstrap';
import * as T from './commonTypes';
import {ShellFormsContainer} from './ShellForms';
import {TargetFormsContainer} from './TargetForms';
import AllCharts from './Charts';
import AllCharts from './Charts/Charts';
import {NavbarCustom} from './Navbar';
import {SettingsBar} from './SettingsBar';

Expand Down
5 changes: 5 additions & 0 deletions src/components/Charts/Charts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.carousel-control{
display: grid !important;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-gap: 0;
}
22 changes: 14 additions & 8 deletions src/components/Charts.tsx → src/components/Charts/Charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import 'chartjs-plugin-annotation';
import {Button, Collapse, Row, Col, Carousel, ToggleButtonGroup, ToggleButton, ButtonGroup} from 'react-bootstrap';
import {Icon} from 'semantic-ui-react';

import * as T from './commonTypes';
import {DownloadButton, GeneralTooltip} from './UtilityComponents';
import * as T from '../commonTypes';
import {DownloadButton, GeneralTooltip} from '../UtilityComponents';
import './Charts.css';

// chartConfigs type
interface chartDataOption{data: Record<string, any>, options: Record<string, any>}
Expand Down Expand Up @@ -126,17 +127,22 @@ class SubGroup extends React.Component<subGroupProps, {index: number}>{
private handleSelect = (selectedIndex:number, e) => {
this.setState({index: selectedIndex});
}
private handleSelectButton = event => {
this.setState({index: parseInt(event.target.value)});
private handleSelectButton = value => {
this.setState({index: parseInt(value)});
}
private addButtons = () => {
return (
<ToggleButtonGroup toggle
type="radio" name="radio"
value={this.state.index}>
type="radio" name="radio" className="carousel-control"
value={this.state.index}
onChange={this.handleSelectButton}>
{this.props.config.map((config, i) => {
return(
<ToggleButton key={i} value={i} type="radio" onChange={this.handleSelectButton}>
<ToggleButton
key={i}
value={i}
type="radio"
variant="secondary">
{config[singleChartIndex.name]}
</ToggleButton>
);
Expand Down Expand Up @@ -290,7 +296,7 @@ export class ChartGroup extends React.Component<chartGroupProps>{
this.chartConfigs.post.forEach((chart, i) => {
chart[singleChartIndex.name] = 'Horizontal Impact Angle ' + (i + 1);});

const initialJson = require('../static/initialData.json');
const initialJson = require('../../static/initialData.json');
this.updateData(initialJson, false);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/commonTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import {SingleChart} from './Charts';
import {SingleChart} from './Charts/Charts';
import {ShellFormsContainer} from './ShellForms';
import {TargetFormsContainer} from './TargetForms';
import {SettingsBar} from './SettingsBar';
Expand Down

0 comments on commit 3a89720

Please sign in to comment.