ISSUE-032 - Making some organizational changes to how the Chyron director controls are built. Have more work to perform but making a checkpoint commit to keep track of my work so far.
This commit is contained in:
1 parent
5e7940a151
commit
d5b653da9d
4 files changed
+67
-43
No files matched your search
@@ -13,6 +13,7 @@ type SlotSelectorProps = {
|
||||
formatter?: (value: string) => string,
|
||||
initialIndex?: number,
|
||||
disabled?: boolean,
|
||||
slotWidth?: string,
|
||||
};
|
||||
/**
|
||||
* If items are defined in a component make sure they are stateful to prevent
|
||||
@@ -26,6 +27,7 @@ export function SlotSelector({
|
||||
formatter = (x) => x,
|
||||
initialIndex = 0,
|
||||
disabled = false,
|
||||
slotWidth = "6ch",
|
||||
}: SlotSelectorProps) {
|
||||
const [index, setIndex] = useState(initialIndex);
|
||||
const [prefixMask, setPrefixMask] = useState(0);
|
||||
@@ -74,7 +76,7 @@ export function SlotSelector({
|
||||
{(label ?? null) && (
|
||||
<SelectorLabel>{label}</SelectorLabel>
|
||||
)}
|
||||
<SlotWindow onClick={onClick} disabled={disabled}>
|
||||
<SlotWindow onClick={onClick} disabled={disabled} width={slotWidth}>
|
||||
{transitions((style, i) => (
|
||||
<SlotText as={animated.span} style={style}>{getItem(i)}</SlotText>
|
||||
))}
|
||||
|
||||
@@ -2,11 +2,13 @@ import styled from "styled-components";
|
||||
|
||||
type SlotWindowProps = {
|
||||
disabled: boolean,
|
||||
width?: string,
|
||||
};
|
||||
export const SlotWindow = styled.div<SlotWindowProps>`
|
||||
position: relative;
|
||||
height: 1.5em;
|
||||
width: auto;
|
||||
width: ${({ width = "auto" }) => width};
|
||||
min-width: 6ch;
|
||||
|
||||
border-radius: 0.6em;
|
||||
background-color: ${({ disabled }) => disabled
|
||||
|
||||
Reference in new issue
Block a user