mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
added radio to pricing tabs on publish (#1067)
* added radio to pricing tabs on publish * adding padding to tabs with radio * correct unnecessary component and style class * adding attribute selector to css rule
This commit is contained in:
parent
fab181be34
commit
e2c468c128
@ -96,7 +96,6 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
color: var(--font-color-text);
|
|
||||||
padding-left: 0.5rem;
|
padding-left: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,10 @@
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab > div {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.tabContent {
|
.tabContent {
|
||||||
padding: calc(var(--spacer) / 2);
|
padding: calc(var(--spacer) / 2);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { ReactElement, ReactNode } from 'react'
|
import React, { ReactElement, ReactNode } from 'react'
|
||||||
import { Tab, Tabs as ReactTabs, TabList, TabPanel } from 'react-tabs'
|
import { Tab, Tabs as ReactTabs, TabList, TabPanel } from 'react-tabs'
|
||||||
|
import InputElement from '@shared/FormInput/InputElement'
|
||||||
import styles from './Tabs.module.css'
|
import styles from './Tabs.module.css'
|
||||||
|
|
||||||
export interface TabsItem {
|
export interface TabsItem {
|
||||||
@ -12,12 +13,14 @@ export default function Tabs({
|
|||||||
items,
|
items,
|
||||||
className,
|
className,
|
||||||
handleTabChange,
|
handleTabChange,
|
||||||
defaultIndex
|
defaultIndex,
|
||||||
|
showRadio
|
||||||
}: {
|
}: {
|
||||||
items: TabsItem[]
|
items: TabsItem[]
|
||||||
className?: string
|
className?: string
|
||||||
handleTabChange?: (tabName: string) => void
|
handleTabChange?: (tabName: string) => void
|
||||||
defaultIndex?: number
|
defaultIndex?: number
|
||||||
|
showRadio?: boolean
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
return (
|
return (
|
||||||
<ReactTabs
|
<ReactTabs
|
||||||
@ -25,14 +28,24 @@ export default function Tabs({
|
|||||||
defaultIndex={defaultIndex}
|
defaultIndex={defaultIndex}
|
||||||
>
|
>
|
||||||
<TabList className={styles.tabList}>
|
<TabList className={styles.tabList}>
|
||||||
{items.map((item) => (
|
{items.map((item, index) => (
|
||||||
<Tab
|
<Tab
|
||||||
className={styles.tab}
|
className={styles.tab}
|
||||||
key={item.title}
|
key={item.title}
|
||||||
onClick={handleTabChange ? () => handleTabChange(item.title) : null}
|
onClick={handleTabChange ? () => handleTabChange(item.title) : null}
|
||||||
disabled={item.disabled}
|
disabled={item.disabled}
|
||||||
>
|
>
|
||||||
{item.title}
|
{showRadio ? (
|
||||||
|
<InputElement
|
||||||
|
name={item.title}
|
||||||
|
type="radio"
|
||||||
|
checked={defaultIndex === index}
|
||||||
|
options={[item.title]}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
item.title
|
||||||
|
)}
|
||||||
</Tab>
|
</Tab>
|
||||||
))}
|
))}
|
||||||
</TabList>
|
</TabList>
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pricing ul > li[class*='Tabs_tab'] {
|
||||||
|
padding: calc(var(--spacer) / 4) var(--spacer);
|
||||||
|
}
|
||||||
|
|
||||||
.pricing [class*='Tabs_tabContent'] {
|
.pricing [class*='Tabs_tabContent'] {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
@ -71,6 +71,7 @@ export default function PricingFields(): ReactElement {
|
|||||||
handleTabChange={handleTabChange}
|
handleTabChange={handleTabChange}
|
||||||
defaultIndex={type === 'dynamic' ? 1 : type === 'free' ? 2 : 0}
|
defaultIndex={type === 'dynamic' ? 1 : type === 'free' ? 2 : 0}
|
||||||
className={styles.pricing}
|
className={styles.pricing}
|
||||||
|
showRadio
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user