Skip to content

Commit

Permalink
Add OS logos to the OS selection
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSSD7 committed Aug 9, 2021
1 parent e6ca321 commit 6997b14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
10 changes: 6 additions & 4 deletions components/guides/ButtonGroupOSSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { useRouter } from 'next/router';
function ButtonGroupOSSelector() {
const router = useRouter();
const osList = {
linux: 'Linux',
windows: 'Windows',
macOS: 'macOS',
linux: { label: 'Linux', logoURL: 'https://static.flexpool.io/assets/os/linux.png' },
windows: {
label: 'Windows',
logoURL: 'https://static.flexpool.io/assets/os/windows.png',
},
};
const [selectedOS, setSelectedOS] = useState('');
let search;
let search: string;

useEffect(() => {
if (typeof window !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion components/guides/flexfarmer/FlexfarmerDownloads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function FlexfarmerDownloads() {

return (
<>
{downloadData && (
{downloadData && downloadData.map && (
<ul className="unstyled flex flex-wrap">
{downloadData.map((item) => (
<li key={item.name} className="mr-2">
Expand Down
13 changes: 11 additions & 2 deletions src/pages/GetStarted/ChiaShared/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ const ButtonGroupWrapper = styled.div`
}
`;

const OptionThumbnail = styled.img`
height: 2em;
width: 2em;
margin-right: 1em;
`;

type ButtonGroupProps = {
options: { [key: string]: string };
options: { [key: string]: { label: string; logoURL?: string } };
selectedOption: string;
setSelectedOption: (s: string) => void;
};
Expand All @@ -51,7 +57,10 @@ export const ButtonGroup = (props: ButtonGroupProps) => {
onClick={() => props.setSelectedOption(key)}
className={`${props.selectedOption === key ? 'selected' : ''}`}
>
{props.options[key] as string}
{props.options[key].logoURL && (
<OptionThumbnail src={props.options[key].logoURL} />
)}
{props.options[key].label as string}
</Button>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/GetStarted/ChiaShared/FarmerOptionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const FarmerOptionSelector = (props: FarmerOptionProps) => {
return (
<ButtonGroup
options={{
'new-farmer': t('detail_xch.new_farmer'),
'already-farmer': t('detail_xch.already_farmer'),
'new-farmer': { label: t('detail_xch.new_farmer') },
'already-farmer': { label: t('detail_xch.already_farmer') },
}}
setSelectedOption={(s: string) => {
setSelectedFarmerOption(s);
Expand Down

0 comments on commit 6997b14

Please sign in to comment.