From c6f98d59285656f179eea80662e86f7cf5329e59 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Mon, 30 Nov 2020 18:51:52 +0100 Subject: Add aria-labels Add aria-labels to odlux framework and apps Issue-ID: CCSDK-2886 Signed-off-by: Aijana Schumann Change-Id: If1fdf9f8a805b567dd65bcf2cfb029b71f9235b7 --- .../framework/src/components/objectDump/index.tsx | 56 +++++++++++++++++----- 1 file changed, 44 insertions(+), 12 deletions(-) (limited to 'sdnr/wt/odlux/framework/src/components/objectDump/index.tsx') diff --git a/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx b/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx index d449f5cd3..d2de7cc02 100644 --- a/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx +++ b/sdnr/wt/odlux/framework/src/components/objectDump/index.tsx @@ -70,20 +70,50 @@ const useSimpleTableStyles = makeStyles({ color: "white", padding: "5px", backgroundColor: "#cccccc", + }, td: { verticalAlign: "top", padding: "0.5rem 1rem", - borderBottom: "2px solid #DDD" + border: "2px solid #DDD" }, object: { }, objectTh: { - backgroundColor: "#4444cc", + backgroundColor: "#cccccc", }, objectTd: { padding: "0.5rem 1rem", - borderBottom: "2px solid #DDD" + border: "2px solid #DDD" + }, + chevron: { + '&:before': { + borderStyle: 'solid', + borderWidth: '0.25em 0.25em 0 0', + content: '\'\'', + display: 'inline-block', + height: '0.45em', + left: '0.15em', + position: 'relative', + top: '0.15em', + transform: 'rotate(-45deg)', + transition: 'all 0.3s', + verticalAlign: 'top', + width: '0.45em', + } + + }, + right: { + '&:before': { + left: '0', + transform: 'rotate(45deg)', + } + }, + bottom: { + '&:before': { + left: '0', + transform: 'rotate(135deg)', + } }, }); @@ -93,6 +123,7 @@ type SimpleTableProps = { label?: JSX.Element | string | null; cols?: number; expand?: boolean; + ariaLabel?: string; } const SimpleTable: React.FC = (props) => { @@ -110,11 +141,11 @@ const SimpleTable: React.FC = (props) => { }; return ( - +
{label && ( - + ) || null @@ -130,6 +161,7 @@ type ObjectRendererProps = { label?: JSX.Element | string | null; expand?: boolean; object: { [key: string]: any }; + ariaLabel?: string; }; const ObjectRenderer: React.FC = (props) => { @@ -137,13 +169,13 @@ const ObjectRenderer: React.FC = (props) => { const classes = useSimpleTableStyles(); return ( - + { Object.keys(object).map(key => { return ( - - - + + + ); }) @@ -165,9 +197,9 @@ const ArrayRenderer: React.FC = (props) => { return null; }; -export const renderObject = (object: any): JSX.Element | string => { +export const renderObject = (object: any, ariaLabel?: string): JSX.Element | string => { if (isString(object) || isNumber(object) || isBoolean(object)) { return String(object); } - return ; + return ; }; -- cgit 1.2.3-korg
- {label} + { label }
{String(key)} {renderObject(object[key])}
{String(key)} {renderObject(object[key], "sub-element")}