-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update component screens
- Loading branch information
Showing
32 changed files
with
1,935 additions
and
671 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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { PropsWithChildren } from "react"; | ||
import { ViewProps } from "react-native"; | ||
import { | ||
Box, | ||
styleAdapter, | ||
Text, | ||
useTheme, | ||
} from "@adaptui/react-native-tailwind"; | ||
|
||
export interface GroupType extends ViewProps { | ||
label: string; | ||
} | ||
|
||
export const Group = (props: PropsWithChildren<GroupType>) => { | ||
const { children, label, style, ...other } = props; | ||
const tailwind = useTheme(); | ||
return ( | ||
<Box | ||
style={[ | ||
tailwind.style("bg-white-800 rounded-xl p-2 flex-col w-full"), | ||
styleAdapter(style), | ||
]} | ||
{...other} | ||
> | ||
<Text style={tailwind.style("ml-3 font-bold")}>{label}</Text> | ||
<Box | ||
style={tailwind.style( | ||
"flex flex-row flex-wrap justify-start items-center mt-2 ml-0", | ||
)} | ||
> | ||
{children} | ||
</Box> | ||
</Box> | ||
); | ||
}; |
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 @@ | ||
export * from "./Group"; |
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,33 +1,113 @@ | ||
import React from "react"; | ||
import { Box, Meter, useTheme } from "@adaptui/react-native-tailwind"; | ||
import React, { SetStateAction, useState } from "react"; | ||
import { | ||
Box, | ||
Meter, | ||
MeterSizes, | ||
MeterTheme, | ||
Radio, | ||
RadioGroup, | ||
Switch, | ||
useTheme, | ||
} from "@adaptui/react-native-tailwind"; | ||
|
||
import { Group } from "../../components"; | ||
|
||
export const MeterComponentScreen = () => { | ||
const tailwind = useTheme(); | ||
return ( | ||
<Box style={tailwind.style("flex-1 justify-center px-2 bg-white-900")}> | ||
<Box style={tailwind.style("my-2")}> | ||
<Meter intervals={3} value={0.55} /> | ||
</Box> | ||
<Box style={tailwind.style("my-2")}> | ||
<Meter themeColor="primary" intervals={3} value={0.85} /> | ||
</Box> | ||
<Box style={tailwind.style("my-2")}> | ||
<Meter themeColor="success" intervals={3} value={0.25} /> | ||
</Box> | ||
|
||
<Box style={tailwind.style("my-2")}> | ||
<Meter label="Stocks" themeColor="success" intervals={3} value={0.25} /> | ||
</Box> | ||
const [selectedTheme, setSelectedTheme] = useState<MeterTheme>("base"); | ||
const [selectedSize, setSelectedSize] = useState<MeterSizes>("md"); | ||
const [hasFlatBorder, setHasFlatBorders] = useState<boolean>(false); | ||
const [hasIntervals, setHasIntervals] = useState<boolean>(false); | ||
const [hasHints, setHasHints] = useState<boolean>(false); | ||
const [hasLabel, setHasLabel] = useState<boolean>(false); | ||
|
||
<Box style={tailwind.style("my-2")}> | ||
return ( | ||
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}> | ||
<Box | ||
style={tailwind.style( | ||
"flex-1 px-2 justify-center items-center bg-white-900", | ||
)} | ||
> | ||
<Meter | ||
label="Progress" | ||
hint="1/3" | ||
themeColor="primary" | ||
intervals={3} | ||
label={!hasLabel ? null : "Progress"} | ||
hint={!hasHints ? null : "1/3"} | ||
themeColor={selectedTheme} | ||
intervals={!hasIntervals ? 1 : 3} | ||
value={0.33} | ||
size={selectedSize} | ||
flatBorders={hasFlatBorder} | ||
/> | ||
</Box> | ||
<Box | ||
style={tailwind.style( | ||
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2", | ||
)} | ||
> | ||
<RadioGroup | ||
value={selectedSize} | ||
onChange={(value: MeterSizes) => setSelectedSize(value)} | ||
orientation="horizontal" | ||
> | ||
<Group label="Sizes"> | ||
<Radio value="sm" label="sm" /> | ||
<Radio value="md" label="md" /> | ||
<Radio value="lg" label="lg" /> | ||
</Group> | ||
</RadioGroup> | ||
<RadioGroup | ||
value={selectedTheme} | ||
onChange={(value: MeterTheme) => setSelectedTheme(value)} | ||
orientation="horizontal" | ||
> | ||
<Group label="Theme" style={tailwind.style("mt-2")}> | ||
<Radio value="base" label="base" /> | ||
<Radio value="primary" label="primary" /> | ||
<Radio value="success" label="success" /> | ||
</Group> | ||
</RadioGroup> | ||
<Box | ||
style={tailwind.style( | ||
"flex flex-row justify-start flex-wrap w-full mt-2", | ||
)} | ||
> | ||
<Switch | ||
state={hasLabel} | ||
onStateChange={(value: SetStateAction<boolean>) => | ||
setHasLabel(value) | ||
} | ||
size="md" | ||
label="Label" | ||
/> | ||
<Switch | ||
state={hasHints} | ||
onStateChange={(value: SetStateAction<boolean>) => | ||
setHasHints(value) | ||
} | ||
size="md" | ||
style={tailwind.style("ml-1")} | ||
label="Hints" | ||
/> | ||
<Switch | ||
state={hasIntervals} | ||
onStateChange={(value: SetStateAction<boolean>) => | ||
setHasIntervals(value) | ||
} | ||
size="md" | ||
style={tailwind.style("ml-1")} | ||
label="Intervals" | ||
/> | ||
<Switch | ||
state={hasFlatBorder} | ||
onStateChange={(value: SetStateAction<boolean>) => | ||
setHasFlatBorders(value) | ||
} | ||
size="md" | ||
style={tailwind.style("mt-1")} | ||
label="Flat Borders" | ||
/> | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
}; |
Oops, something went wrong.