({ columns, ...htmlProps })
| 145 | }; |
| 146 | |
| 147 | const XGrid: FC<XGridProps> = ({ columns, ...htmlProps }) => { |
| 148 | const borderDefault = |
| 149 | typeof document === "undefined" |
| 150 | ? "hsl(var(--border-default))" |
| 151 | : `hsl(${getComputedStyle(document.documentElement) |
| 152 | .getPropertyValue("--border-default") |
| 153 | .trim()})`; |
| 154 | |
| 155 | return ( |
| 156 | <div |
| 157 | role="presentation" |
| 158 | {...htmlProps} |
| 159 | className={cn( |
| 160 | "flex w-full h-full absolute top-0 left-0", |
| 161 | htmlProps.className, |
| 162 | )} |
| 163 | > |
| 164 | {[...Array(columns).keys()].map((key) => ( |
| 165 | <div |
| 166 | key={key} |
| 167 | className="flex-shrink-0 bg-repeat-y bg-right" |
| 168 | style={{ |
| 169 | width: "var(--x-axis-width)", |
| 170 | backgroundImage: `url("${dashedLine(borderDefault)}")`, |
| 171 | }} |
| 172 | /> |
| 173 | ))} |
| 174 | </div> |
| 175 | ); |
| 176 | }; |
| 177 | |
| 178 | // A dashed line is used as a background image to create the grid. |
| 179 | // Using it as a background simplifies replication along the Y axis. |
nothing calls this directly
no test coverage detected