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: "class"
      }), "를 사용해 엘리먼트의 ", jsx(_components.code, {
        children: "className"
      }), " 프로퍼티를 설정할 수 있습니다. 하지만 조건문을 사용해 class를 설정하는 것이 편한 경우가 많습니다. 이러한 이유로, Solid는 키가 class 이름이고 값이 boolean 표현식인 객체를 받는 빌트인 ", jsx(_components.code, {
        children: "classList"
      }), " JSX 속성을 제공합니다. 표현식이 true인 경우 class가 적용되며, 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-85c0460b.js.map
