Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTML・CMSから考えるコンポーネント化について

redamoon
January 27, 2018
330

 HTML・CMSから考えるコンポーネント化について

redamoon

January 27, 2018
Tweet

Transcript

  1. <div class="card card--blue"> <figure class="card__element"> <figcaption>Ωϟϓγϣϯ01ͷςΩετΩϟϓγϣϯ01ͷςΩετ</figcaption> <img src="dummy01.jpg" alt="Ωϟϓγϣϯ01ͷςΩετ"> </figure>

    <a class="card__button" href=“/path/“>Ϙλϯ01</a> </div> <div class="card card--black"> <figure class="card__element"> <figcaption>Ωϟϓγϣϯ02ͷςΩετΩϟϓγϣϯ02ͷςΩετ</figcaption> <img src="dummy02.jpg" alt="Ωϟϓγϣϯ02ͷςΩετ"> </figure> <a class=“card__button" href=“/path/“>Ϙλϯ02</a> </div> )5.-σʔλ
  2. $.4Խʢ.PWBCMF5ZQFͷྫʣ <mt:Ignore>Layout Card Block Component</mt:Ignore> <mt:SetVarTemplate name="_base_card" key="base_card" note="Layout Card

    Block Component"> <div class="card <mt:Var name="_base_card_class-modifier" />"> <figure class="card__element"> <figcaption><mt:Var name="_base_card_text" /></figcaption> <img src="<mt:Var name="_base_card_img" />" alt="<mt:Var name="_base_card_text" />"> </figure> <a class="card__button" href="<mt:Var name="_base_card_button-link" />"><mt:Var name="_base_card_button-name" /></a> </div> </mt:SetVarTemplate>
  3. $.4Խʢ.PWBCMF5ZQFͷ৔߹ʣग़ྗ <mt:Ignore>Layout Card Block Component Output</mt:Ignore> <mt:Var name="_base_card" key="button" _base_card_class-modifier="card--blue"

    _base_card_text="Ωϟϓγϣϯ01ͷςΩετΩϟϓγϣϯ01ͷςΩετ" _base_card_img="dummy01.jpg" _base_card_button-link="/path/" _base_card_button-name="button_name" /> <mt:Var name="_base_card" key="button" _base_card_class-modifier="card--black" _base_card_text="Ωϟϓγϣϯ02ͷςΩετΩϟϓγϣϯ02ͷςΩετ" _base_card_img=“dummy02.jpg" _base_card_button-link="/path/" _base_card_button-name="button_name" />
  4. )5.-σʔλʢ/VOKVDLTͷ৔߹ʣ {# Layout Card Block Component #} {% macro _base_card(_base_card_class-modifier,_base_card_text,_base_card_img,_base_card_button-

    link,_base_card_button-name) %} <div class="card {{ _base_card_class-modifier }}"> <figure class="card__element"> <figcaption>{{ _base_card_text }}</figcaption> <img src="{{ _base_card_img }}" alt="{{ _base_card_text }}"> </figure> <a class="card__button" href="{{ _base_card_button-link }}"> {{ _base_card_button-name }} </a> </div> {% endmacro %}
  5. )5.-σʔλʢ/VOKVDLTͷ৔߹ʣग़ྗ {# Layout Card Block Component Setting #} {% import

    '_partial/component.html' as component %} {# Layout Card Block Component Output #} {{ component._base_card('card--blue', 'text', 'dummy01.jpg' '/path/', 'button-name') }} {{ component._base_card('card--black', 'text', 'dummy02.jpg' '/path/', 'button-name') }}
  6. ஋ͱߏ଄ͷ෼ׂ <div class="card card--blue"> <figure class="card__element"> <figcaption>Ωϟϓγϣϯ01ͷςΩετΩϟϓγϣϯ01ͷςΩετ</figcaption> <img src="dummy01.jpg" alt="Ωϟϓγϣϯ01ͷςΩετ">

    </figure> <a class="card__button" href=“/path/“>Ϙλϯ01</a> </div> ɾߏ଄ʢ)5.-ʣͷ؅ཧΛҰͭʹ·ͱΊΔ ɾ஋͸೚ҙͰมߋՄೳʹ͢Δ ɾ܁Γฦ͢෦෼͸ϧʔϓͳͲΛ׆༻͢Δ