Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
addind slider component
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatou Mounzeo committed Jul 16, 2019
1 parent 204b942 commit 9f860b3
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/view/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"use strict";
import * as React from "react";
import Simulator from "./components/Simulator";
import InputSlider from "./components/toolbar/InputSlider"
import "./App.css";

class App extends React.Component {
Expand All @@ -12,6 +13,7 @@ class App extends React.Component {
<div className="App">
<header className="App-header">
<Simulator />
<InputSlider min={0} max={250} title={"slider"} step={1} min_label={"min"} max_label={"max"}/>
<a
className="App-link"
href="https://github.com/microsoft/vscode-python-embedded"
Expand Down
35 changes: 35 additions & 0 deletions src/view/components/toolbar/InputSlider.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.sliderArea{
height: 32px;
border-color: brown;
background-color: greenyellow;
}
.sliderValue{
text-align: center;
width: 48px;
height: 32px;
background-color: var(--vscode-editor-background);
color: white;
border:0;
margin-right: 15px;
vertical-align: middle;


}

.slider{
-webkit-appearance: none;
background-color: #cccccc;
color: var(--vscode-textLink-activeForeground);
vertical-align: middle;
height: 1px;

}
.slider::-webkit-slider-thumb{
color: yellow;
}
.slider::-ms-track{
color: var(--vscode-textLink-activeForeground);
}
.slider:focus{
border: var(--focusBorder)
}
50 changes: 50 additions & 0 deletions src/view/components/toolbar/InputSlider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as React from "react";
import "./InputSlider.css"


interface ISliderProps{
min:number;
max: number;
min_label: string;
max_label: string;
title: string;
step:number;
}



class InputSlider extends React.Component<ISliderProps,any,any>{
constructor(props: ISliderProps){
super(props);
this.state = {
value:0
};

this.handleOnChange = this.handleOnChange.bind(this);
}


render(){
return (
<div className="sliderArea">
<input className="sliderValue" value={this.state.value}/>
<input type="range" className="slider" aria-valuemin={this.props.min} aria-valuemax={this.props.max} step={this.props.step} title={this.props.title} onChange={this.handleOnChange} aria-valuenow={this.state.value}/>

</div>
)
}

private handleOnChange(event: React.ChangeEvent<HTMLInputElement>){
const inputElement = event.target
const newValue = inputElement? inputElement.value:0;
this.setState({value:newValue});

}

}

export default InputSlider;

0 comments on commit 9f860b3

Please sign in to comment.