import { jsx, jsxs, Fragment } from 'solid-jsx/jsx-runtime';

/*@jsxRuntime automatic @jsxImportSource solid-jsx*/
const toc = [];
function _createMdxContent(props) {
  const _components = Object.assign({
    p: "p",
    code: "code",
    pre: "pre",
    span: "span"
  }, props.components);
  return jsxs(Fragment, {
    children: [jsxs(_components.p, {
      children: ["Solid unterstützt sowohl ", jsx(_components.code, {
        children: "class"
      }), " als auch ", jsx(_components.code, {
        children: "className"
      }), ", um die ", jsx(_components.code, {
        children: "className"
      }), "-Eigenschaft eines Elements zu setzen. Allerdings ist es häufig bequemer, bestimmte Klassen fallweise zu setzen. Aus diesem Grund hat Solid ein eingebautes ", jsx(_components.code, {
        children: "classList"
      }), "-JSX-Attribut, das ein Objekt entgegen nimmt, in dem unter den Klassennamen ein Boolean gespeichert ist. Wenn der Boolean wahr ist, wird die Klasse gesetzt, ansonsten entfernt."]
    }), "\n", jsx(_components.p, {
      children: "In diesem Beispiel können wir folgendes ersetzen:"
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: ["<button\n  ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "class"
        }), "={", jsx(_components.span, {
          className: "hljs-title function_",
          children: "current"
        }), "() === ", jsx(_components.span, {
          className: "hljs-string",
          children: "'foo'"
        }), " ? ", jsx(_components.span, {
          className: "hljs-string",
          children: "'selected'"
        }), " : ", jsx(_components.span, {
          className: "hljs-string",
          children: "''"
        }), "}\n  onClick={", jsx(_components.span, {
          className: "hljs-function",
          children: "() =>"
        }), " ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "setCurrent"
        }), "(", jsx(_components.span, {
          className: "hljs-string",
          children: "'foo'"
        }), ")}\n>foo</button>\n"]
      })
    }), "\n", jsx(_components.p, {
      children: "mit:"
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: ["<button\n  classList={{", jsx(_components.span, {
          className: "hljs-attr",
          children: "selected"
        }), ": ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "current"
        }), "() === ", jsx(_components.span, {
          className: "hljs-string",
          children: "'foo'"
        }), "}}\n  onClick={", jsx(_components.span, {
          className: "hljs-function",
          children: "() =>"
        }), " ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "setCurrent"
        }), "(", jsx(_components.span, {
          className: "hljs-string",
          children: "'foo'"
        }), ")}\n>foo</button>\n"]
      })
    }), "\n", jsx(_components.p, {
      children: "Hinweis: Klassennamen kann man auch dynamisch setzen, etwa aus CSS-Modulen:"
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-jsx",
        children: [jsx(_components.span, {
          className: "hljs-keyword",
          children: "import"
        }), " { active } ", jsx(_components.span, {
          className: "hljs-keyword",
          children: "from"
        }), " ", jsx(_components.span, {
          className: "hljs-string",
          children: "\"./style.module.css\""
        }), "\n\n<div classList={{ [active]: ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "isActive"
        }), "() }} />\n"]
      })
    })]
  });
}
function MDXContent(props = {}) {
  const {wrapper: MDXLayout} = props.components || ({});
  return MDXLayout ? jsx(MDXLayout, Object.assign({}, props, {
    children: jsx(_createMdxContent, props)
  })) : _createMdxContent(props);
}

export { MDXContent as default, toc };
//# sourceMappingURL=lesson-c3ade781.js.map
