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 は、要素の ", jsx(_components.code, {
        children: "className"
      }), " プロパティを設定するのに、", jsx(_components.code, {
        children: "class"
      }), " を使用します。しかし、条件付きでクラスを設定するのが便利な場合もあります。そのため、Solid には組み込みの ", jsx(_components.code, {
        children: "classList"
      }), " JSX 属性があり、キーがクラス名、値が真偽の式であるオブジェクトを受け取ります。true の場合はクラスが適用され、false の場合はクラスが削除されます。"]
    }), "\n", jsx(_components.p, {
      children: "この例では、これを:"
    }), "\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: "こう置き換えることができます:"
    }), "\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: "CSS モジュールで受け取る時と同じように、動的に名前を付けられることを覚えておいてください:"
    }), "\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-a0353507.js.map
