Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
181 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { boards } from '../lib/constants'; | ||
|
||
export default ({ filter=()=>{}, recommended, value, ...props }) => { | ||
const filteredBoards = boards.filter(filter); | ||
|
||
return ( | ||
<select {...props} value={value || ''}> | ||
{!filteredBoards.some(b => b.id === value) && <option>Pick one...</option>} | ||
{filteredBoards.map(board => ( | ||
<option key={board.id} value={board.id}> | ||
{board.name} | ||
{board.id === recommended && ' (recommended)'} | ||
</option> | ||
))} | ||
</select> | ||
) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React from 'react'; | ||
import { analogPins, digitalPins, pwmPins, interruptPins } from '../lib/constants'; | ||
import { chips } from '../lib/constants'; | ||
|
||
const Dropdown = ({pinList, ...props}) => ( | ||
<select {...props}> | ||
{pinList.map(p => <option value={p} key={p}>{p}</option>)} | ||
</select> | ||
); | ||
|
||
export const AnalogPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={analogPins[chip]} {...props} />; | ||
export const DigitalPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={digitalPins[chip]} {...props} />; | ||
export const PWMPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={pwmPins[chip]} {...props} />; | ||
export const InterruptPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={interruptPins[chip]} {...props} />; | ||
export const AnalogPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={chips[chip].pins.analog} {...props} />; | ||
export const DigitalPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={chips[chip].pins.digital} {...props} />; | ||
export const PWMPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={chips[chip].pins.pwm} {...props} />; | ||
export const InterruptPins = ({ chip = 'atmega328', ...props }) => <Dropdown pinList={chips[chip].pins.interrupt} {...props} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.