Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/Editor/EditorControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ const EditorControls = ({
<RiLinksLine size={16} />
</Button>

<div className="xl:hidden block">
<div className="xl:block hidden max-w-36 2xl:max-w-full">
<ExampleSelector onExampleChange={onExampleChange} />
</div>
<div className="xl:block hidden">
<div className="xl:hidden block">
<MobileExampleSelector onExampleChange={onExampleChange} />
</div>
</div>
Expand Down
20 changes: 6 additions & 14 deletions components/Editor/ExampleSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ const examplesOptions = Examples.Cairo.map((_, i) => ({
label: CairoExampleNames[i],
}))

function ExampleSelector({ onExampleChange }: Props) {
export function MobileExampleSelector({ onExampleChange }: Props) {
return (
<Select
onChange={onExampleChange}
options={examplesOptions}
defaultValue={examplesOptions[0]}
components={{
DropdownIndicator,
}}
Expand All @@ -45,32 +46,23 @@ function ExampleSelector({ onExampleChange }: Props) {
)
}

export default ExampleSelector

export function MobileExampleSelector({ onExampleChange }: Props) {
export function ExampleSelector({ onExampleChange }: Props) {
return (
<Select
onChange={onExampleChange}
options={examplesOptions}
defaultValue={examplesOptions[0]}
classNamePrefix="select"
placeholder={'Choose Cairo Example'}
menuPlacement="top"
isSearchable={false}
instanceId={useId()}
styles={{
placeholder: (baseStyles) => ({
...baseStyles,
color: '#4B5563',
':hover': {
color: '#111827',
},
whiteSpace: 'nowrap',
}),
}}
/>
)
}

export default ExampleSelector

const reactSelectStyles: StylesConfig<
SelectOption,
false,
Expand Down
2 changes: 1 addition & 1 deletion components/Editor/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ ret;
}

export const CairoExampleNames = [
'Simple',
'Simple program',
'Variables & mutability',
// 'Type casting',
'Control flow',
Expand Down